So I'm wondering if It was possible to bring in front my terminal when what I ran is now done.
I'm not taking about a one time stuff like
run_long_task; bring_to_front_somehow;
but something that would do it automatically.
This would greatly improved my productivity :)
I'm using zshell(if that helps)
You first need to install
wmctrl
which is a command line tool to interact with an EWMH/NetWM compatible X Window Manager:In order to focus the right Terminal, you'll need to start it with a given title, like this:
Then you can bring it to the front with the following command:
Note:
wmctrl -a STRING
gives focus to a window containing STRING in its titleTested with both
bash
andzsh
Ok I got it working.
So I had to find a way to plug in to the prompt display.
So basicly in my zsh theme I added a method to bring to the front the current window.
$WINDOWID is actually set by gnome-terminal automatically.
and the magic is just to call that method as part of the prompt. this way everytime the prompt is displayed, it will bring it to the front. And since the prompt is displayed when the previous command is finished...
The next thing I'm trying to achieve is to select the right tab. I will update the answer if I get that working.
EDIT
Bonus Switch to the right tab
Disclaimer : This is hacky as hell so bear with me.
this works only for gnome terminal.