GNOME Shell – How to Set Focus to Newly Opened Window

arch linuxfocusgnome-shellkeyboard shortcuts

I use Archlinux 3.17.2-1 with gnome-shell 3.14.1.5-1

I use keyboard shortcut to open various applications, for instance Ctrl+Alt+G opens gnome-terminal and Ctrl+Alt+T opens xfce4-terminal

When pressing Ctrl+Alt+g, the focus is set to the newly openned terminal but when pressing Ctrl+Alt+t the focus doesn't change to the opened terminal.

Is there any command that would make shure the focus is set to the new window ?

Best Answer

I managed to solve this by using a wmctrl call at the end of my .zshrc file

wmctrl -i -a $(wmctrl -l | grep Terminal | tail -n 1 | cut -d ' ' -f1)

This forces the focus to the last openned windows with the name terminal

(I guess the grep Terminal could be removed)

Related Question