I trying to make a script for window switching by hotkey, and one of the features I would to see is "if selecting window is active, switch to previous window"
i tried the following:
#!/bin/bash
class=$1
command=$2
if xdotool search --classname "$class" > /dev/null ;then
if xprop -id $(xdotool getactivewindow) | grep -q "WM_CLASS.*\".*$class.*\"";then
### HERE ###
:#xdotool key --clearmodifiers 'alt+Tab'
else
wmctrl -x -a "$class"
fi
else
if [ -n "$command" ];then
$command &
disown
fi
fi
after the string marked HERE I tried to just send alt+Tab key to wm, but it works bad, because when I doing this I still holding ctrl
modifier, which cause switcher to wait (or stall sometime), so I though about just tell gnome to switch window.
So, is there any way to switch back from shell ?