I have written a small script to hide a Chrome window but want to modify the code to hide the active window. I can use xdotool to get the active window id and hide it. I run into problems when I want to unhide it. How do I check for a hidden window and get the id so I can unhide it? Here is my current code for just hiding chrome:
#!/bin/bash
wid=`xdotool search --name Chrome|head -1`
wstate=`xwininfo -id $wid | grep "Map State:"`
if [[ "$wstate" == *IsViewable ]]
then
xdotool windowunmap $wid
else
xdotool windowmap $wid
fi
Thank you @funivan ! That got me going in the right direction. I am mapping the script to one of my mouse side buttons using xbindkeys. I changed the script a little so I can run the same command to hide or unhide a window.