Created
May 18, 2022 02:26
-
-
Save lopesivan/5db7acd2e640acf7bfe56a008b5e2834 to your computer and use it in GitHub Desktop.
i3wm hide/show google-chrome
This file contains hidden or 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
#!/bin/sh | |
if xwininfo -tree -root | grep -q "chrome" | |
then | |
echo "Window detected." | |
if xdo id -a "Google Chrome" >&- 2>&-; | |
then | |
map_state=$(xwininfo -all -id `xdo id -a "Google Chrome"` | grep "Map State"| cut -d\s -f2) | |
HIDE="xdo hide -a 'Google Chrome'" | |
SHOW="xdo show -a 'Google Chrome'" | |
fi | |
if xdo id -n google-chrome >&- 2>&-; | |
then | |
map_state=`xwininfo -all -id $(xdo id -n google-chrome) | grep "Map State"| cut -d\s -f2` | |
HIDE="xdo hide -n google-chrome" | |
SHOW="xdo show -n google-chrome" | |
fi | |
if [ "$map_state" = 'Viewable' ]; | |
then | |
eval $HIDE | |
else | |
eval $SHOW | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment