diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index 8da9b01c..608fede8 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -11,7 +11,7 @@ from borg import Borg from terminator import Terminator from config import Config from factory import Factory -from util import dbg +from util import dbg, enumerate_descendants CONFIG = Config() if not CONFIG['dbus']: @@ -158,7 +158,15 @@ class DBusService(Borg, dbus.service.Object): window = terminal.get_toplevel() root_widget = window.get_children()[0] if maker.isinstance(root_widget, 'Notebook'): - return root_widget.uuid.urn + #return root_widget.uuid.urn + for tab_child in root_widget.get_children(): + terms = [tab_child] + if not maker.isinstance(terms[0], "Terminal"): + terms = enumerate_descendants(tab_child)[1] + if terminal in terms: + # FIXME: There are no uuid's assigned to the the notebook, or the actual tabs! + # This would fail: return root_widget.uuid.urn + return "" @dbus.service.method(BUS_NAME) def get_tab_title(self, uuid=None): @@ -168,7 +176,12 @@ class DBusService(Borg, dbus.service.Object): window = terminal.get_toplevel() root_widget = window.get_children()[0] if maker.isinstance(root_widget, "Notebook"): - return root_widget.get_tab_label(terminal).get_label() + for tab_child in root_widget.get_children(): + terms = [tab_child] + if not maker.isinstance(terms[0], "Terminal"): + terms = enumerate_descendants(tab_child)[1] + if terminal in terms: + return root_widget.get_tab_label(tab_child).get_label() def with_proxy(func): """Decorator function to connect to the session dbus bus""" diff --git a/terminatorlib/util.py b/terminatorlib/util.py index b1199acc..4a889aeb 100755 --- a/terminatorlib/util.py +++ b/terminatorlib/util.py @@ -17,13 +17,20 @@ """Terminator.util - misc utility functions""" import sys -from gi.repository import Gtk, Gdk import cairo import os import pwd import inspect import uuid import subprocess +import gi + +try: + gi.require_version('Gtk','3.0') + from gi.repository import Gtk, Gdk +except ImportError: + print('You need Gtk 3.0+ to run Remotinator.') + sys.exit(1) # set this to true to enable debugging output DEBUG = False