Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to run a command (assumedly using dbus-send) that opens a new tab in a gnome-terminal session and runs a command. Is this possible?

share|improve this question
add comment

2 Answers

I believe gnome-terminal doesn't have a dbus interface. Trustin Lee has a blog post about Opening a New tab/ gnome-terminal via a shell script, I added an extra line to make use of xdotool to 'fake' the key input, I suppose you can use this approach.

Please note: I haven't tried this myself as I'm supposed to be working in office ;)

#!/bin/sh
# Path: /usr/local/bin/gnome-terminal
if [ "x$*" != "x" ]; then
  /usr/bin/gnome-terminal "$@"
else
  pgrep -u "$USER" gnome-terminal | grep -qv "$$"
  if [ "$?" == "0" ]; then
    WID=`xdotool search --class "gnome-terminal" | head -1`
    xdotool windowfocus $WID
    xdotool key ctrl+shift+t
    wmctrl -i -a $WID
    xdotool type <your-command-here>
  else
    /usr/bin/gnome-terminal
    xdotool type <your-command-here>
  fi
fi
share|improve this answer
add comment
up vote 0 down vote accepted

I ended up using ROXTerm and --tab

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.