Skip to content

Instantly share code, notes, and snippets.

@TimboKZ
Last active March 1, 2023 23:52
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/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