summary refs log tree commit diff
path: root/.local/bin/gnome-terminal-newtab
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/gnome-terminal-newtab')
-rwxr-xr-x.local/bin/gnome-terminal-newtab9
1 files changed, 5 insertions, 4 deletions
diff --git a/.local/bin/gnome-terminal-newtab b/.local/bin/gnome-terminal-newtab
index 79c3a83..a45da9a 100755
--- a/.local/bin/gnome-terminal-newtab
+++ b/.local/bin/gnome-terminal-newtab
@@ -1,13 +1,14 @@
 #!/bin/sh
 
 # We need to set these for it to work
-# TODO: get these from the environment somehow...
-export GNOME_TERMINAL_SERVICE=:1.222
 # specific tab that is focused
 #export GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/2fabbbb8_c971_4140_a182_64474ffb18c5
-export GNOME_TERMINAL_SCREEN="$(busctl --user tree  org.gnome.Terminal | grep -o '/org/gnome/Terminal/screen/.*$' | head -n1)"
+screen="$(busctl --user tree  org.gnome.Terminal | grep -o '/org/gnome/Terminal/screen/.*$' | head -n1)"
+if test "$screen"; then
+    export GNOME_TERMINAL_SCREEN="$screen"
+    export GNOME_TERMINAL_SERVICE="$(busctl --user status  org.gnome.Terminal | grep UniqueName | cut -d= -f2)"
+fi
 
-#echo DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" >> /tmp/terminal-newtab.log
 echo GNOME_TERMINAL_SCREEN="$GNOME_TERMINAL_SCREEN" >> /tmp/terminal-newtab.log
 echo GNOME_TERMINAL_SERVICE="$GNOME_TERMINAL_SERVICE" >> /tmp/terminal-newtab.log
 echo "$@" "\n" >> /tmp/terminal-newtab.log