I'm using Ubuntu 9.04 x64 and when I write:
gnome-terminal --tab
At the terminal, I expect it to open a new tab in the same terminal window. But it opens a new window instead.
I found out that its intention is to open a new tab in a new window, i.e., if I write:
gnome-terminal --tab --tab
It will open a new window with two tabs.
So, the question is, how can I open a new tab in the current window using a command in gnome-terminal
?
#!/bin/sh
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID
xdotool key ctrl+shift+t
wmctrl -i -a $WID
This will auto determine the corresponding terminal and opens the tab accordingly.