I use Archlinux 3.17.2-1 with gnome-shell

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 ?


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)

|improve this answer|||||
  • Can you suggest why the following, which is called from my Openbox rc.xml file, as a keyboard shortcut does not work? gnome-terminal; wmctrl -i -a $(wmctrl -l | grep arch@t430 | tail -n 1 | cut -d ' ' -f1) The first gnome terminal opened comes to focus but not gnome terminal's opened after the first one has been opened & minimised. ps the grep term as you say can be redundant but does find the correct entry at the tail end of the list – Kes Mar 12 '19 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.