views:

4156

answers:

5

Hi, 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?

I'm using Ubuntu 9.04 x64.

+1  A: 

This should solve your problem:

http://gleamynode.net/articles/2236/

Anyway, that is an interesting question. gnome-terminal is the name of the application to launch a new gnome terminal, this is why it opens a new tab in a new window when you launch it from the terminal: it is just like any other program.

If you think that that feature would be useful, I suggest you to file an enhancement bug at gnome and ask the people to implement it: if other people will find the idea useful, they will vote it and it will get implemented.

dalloliogm
Already filed in May 2007, around two years before!https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/117333
Vikrant Chaudhary
Can't get any better answer, so just accepted yours.
Vikrant Chaudhary
well, thanks :)
dalloliogm
Replaced another answer with yours as "Best answer". Thanks for answering anyway.
Vikrant Chaudhary
A: 

I don't have gnome-terminal installed but you should be able to do this by using a DBUS call on the command-line using dbus-send.

Mike McQuaid
+3  A: 

You can also have each tab run a set command.

gnome-terminal --tab -e "tail -f somefile" --tab -e "some_other_command"
Chase Seibert
+2  A: 
#!/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.

drunkcoder
Thanks, works good. In proper form - `WID= xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}'; xdotool windowfocus $WID; xdotool key ctrl+shift+t $WID`
Vikrant Chaudhary
if this works that'll put an end to so many months of frustration. Thanks a lot.
jeffjose
A: 

Also, the reason the original error said Text was empty (or contained only whitespace) was because when the checkbox was checked, the command was missing (under Profiles > Title and Command). So, thinking I could simply add the command and actually use the "Run as a custom command instead of my shell" I entered gnome-terminal --geometry 120x30 and clicked close.

harsha