Automating Gnome Terminal with xdotool + some Terminator short cuts

I’m currently debugging stuff which requires me to begin every session with opening up 3 gnome terminal tabs and executing a different command in each just to get started.

What a chore I thought and started looking for a way to automate this, it turned out to be easier than in one of the most prominent examples. That got me started and then I found this super user example which got me almost to the finish line. This Google group entry finally brought me to the following solution:

xdotool type "./p projects/dist-db/main.l -go 1"
xdotool key Return
xdotool key ctrl+shift+t
xdotool type "./p projects/dist-db/main.l -go 2"
xdotool key Return
xdotool key ctrl+shift+t
xdotool type "./p projects/dist-db/controller.l -go"
xdotool key Return

When save the above as a .sh script in /opt/picolisp and then execute it on the command line it does exactly what I want, it will execute the first command in the current tab, open a new tab and execute the second command and finally open a third tab and execute the last command.

Here is the same behavior but for terminator instead:

xdotool type "./p projects/dist-db/main.l -go 1"
xdotool key Return
xdotool key ctrl+shift+o
xdotool type "./p projects/dist-db/main.l -go 2"
xdotool key Return
xdotool key ctrl+shift+o
xdotool type "./p projects/dist-db/controller.l -go"
xdotool key Return

Now that we’re already talking about terminator let’s go through some short cuts (ripped from here and here):

Ctrl-Shift-E: Split the view vertically.
Ctrl-Shift-O: Split the view horizontally.
Ctrl-Shift-P: Focus be active on the previous view.
Ctrl-Shift-N: Focus be active on the next view.
Ctrl-Shift-W: Close the view where the focus is on.
Ctrl-Shift-Q: Exit terminator.
F11: Make terminator go fullscreen.
Ctrl+Shift+x: Toggle between showing all terminals and only showing the current one.
Ctrl+Shift+Right: Move parent dragbar Right.
Ctrl+Shift+Left: Move parent dragbar Left.
Ctrl+Shift+Up: Move parent dragbar Up.
Ctrl+Shift+Down: Move parent dragbar Down.
Ctrl+Plus (+): Increase font size. Note: this may require you to press shift, depending on your keyboard
Ctrl+Minus (-): Decrease font size. Note: this may require you to press shift, depending on your keyboard
Ctrl+Zero (0): Restore font size to original setting.
Ctrl+TAB: Tab between windows.
ALT+ARROW: Move between windows.


Related Posts

Tags: , ,