4

I ran gnome-terminal --working-directory=$DIR but it opens in a new window, not tab.

Things I've tried:

--tab
-T
--add-tab

Running RHEL5 with zsh

1

2 Answers 2

2

Verbatim copy of the only way to do this that I've ever seen, using xdotool, xprop, & wmctrl.

Source: Open a new tab in gnome-terminal using command line
#!/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.

2
  • What about using xdotool key ctrl+shift+t only?
    – Pandya
    Jan 4, 2016 at 11:16
  • @Pandya - you need to get the window's ID so that you can force xdotool to focus on it prior. Without these there are various situations where the above won't work otherwise.
    – slm
    Jan 4, 2016 at 13:21
-1

If you want to open a new tab into an alredy-existing gnome-terminal window try ctrl-shift-t

1
  • I know that option, but I am intentionally asking for shell scripting
    – user49888
    Sep 18, 2014 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .