Last active
March 1, 2023 23:52
-
-
Save TimboKZ/d05bda63f7f818fdc20c3afa3f6a624d to your computer and use it in GitHub Desktop.
i3 float runner, see: https://foxypanda.me/making-i3-windows-float-without-for-window/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get the command from arguments | |
arg_str="$*" | |
$arg_str & | |
pid="$!" | |
# Wait for the window to open and grab its window ID | |
winid='' | |
while : ; do | |
winid="`wmctrl -lp | awk -vpid=$pid '$3==pid {print $1; exit}'`" | |
[[ -z "${winid}" ]] || break | |
done | |
# Focus the window we found | |
wmctrl -ia "${winid}" | |
# Make it float | |
i3-msg floating enable > /dev/null; | |
# Move it to the center for good measure | |
i3-msg move position center > /dev/null; | |
# Wait for the application to quit | |
wait "${pid}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment