Skip to content

Instantly share code, notes, and snippets.

@TimboKZ

TimboKZ/float-runner.sh

Last active Apr 12, 2021
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