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?
Asked
Active
Viewed 2,273 times
2 Answers
3
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
cjm
- 626
- 5
- 14
Sathyajith Bhat
- 61,504
- 38
- 179
- 264