Skip to content

Instantly share code, notes, and snippets.

@lopesivan
Created May 18, 2022 02:22
Show Gist options
  • Save lopesivan/47ab0c41663d34fc03024b51fd974836 to your computer and use it in GitHub Desktop.
Save lopesivan/47ab0c41663d34fc03024b51fd974836 to your computer and use it in GitHub Desktop.
i3wm hide/show qutebrowser
#!/bin/sh
if xwininfo -tree -root | grep "qutebrowser";
then
echo "Window detected."
map_state=`xwininfo -all -id $(xdo id -N qutebrowser) | grep "Map State"| cut -d\s -f2`
if [ "$map_state" = 'Viewable' ];
then
echo "Window detected."
xdo hide -N qutebrowser
else
echo "Window not detected... spawning."
xdo show -N qutebrowser
fi
else
i3 "exec --no-startup-id qutebrowser"
fi
# if [ "$map_state" = 'UnMapped' ];
# then
# echo "Window not detected... spawning."
# xdo show -N qutebrowser
# fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment