6

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 ?

1 Answer 1

5

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)

2
  • 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, 2019 at 16:00
  • You are a lifesaver. I had this new xfce4 terminal installed which annoyingly was opening without focus in place. That fix is exactly what I needed. Mar 11, 2021 at 17:48

You must log in to answer this question.

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