I am using gnome-shell 3.14 on archlinux 3.17.3-1. I have a keyboard shortcut (ctrl+alt+T) to open an xfce4-terminal.
My issue is that when I triger this shortcut the focus is not set the the newly open terminal.
I tried adding to my .zshrc
[[ -n "$DISPLAY" ]] && wmctrl -i -a $(wmctrl -l | grep Terminal | tail -n 1 | cut -d ' ' -f1)
And that worked ... until I tried opening multiples tabs in a terminal.
When opening a new tab, .zshrc
is run and the focus is moved to the last terminal, wich may not be the open I am currently working on.
So I removed the command from my .zshrc
file and tried editing the command executed my the shortcut keyboard to
xcfe4-terminal&
sleep 0.1
wmctrl -i -a $(wmctrl -l | grep Terminal | tail -n 1 | cut -d ' ' -f1)
I tried increassing the sleep duration, but still it doesn't do the job (focus isn't set)
Therefore I have 2 question :
Is it possible to somehow have a script get the window id of the xfce4-terminal running the script ?
Is it possible to run a command when opening a xfce4-terminal (like if it has in the
.zshrc
even thow it's not in it). I tried the--execute
option but it doesn't suit my needs as is only runs the focusing command and leaves me with a useless window