0

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 ?

1 Answer 1

0

I found some extension which does half of the job of my script, forked it, fixed it and add the feature I described above, so I think the question can be closed.

https://github.com/CZ-NIC/run-or-raise/pull/10

in short, I used

global.display.get_tab_list(0, null)[1];

to get lastWindow, so I focused it using extension api.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .