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