From 550ccf7abfbbefd3026659b826e64c89eca01353 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Sat, 24 Jul 2021 14:15:44 -0400 Subject: [PATCH] add switch_profile_all command to remotinator --- remotinator | 1 + terminatorlib/ipc.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/remotinator b/remotinator index 9a70f372..8258e5c0 100755 --- a/remotinator +++ b/remotinator @@ -48,6 +48,7 @@ COMMANDS={ 'get_tab_title': [True, _('Get the title of a parent tab')], 'set_tab_title': [True, _('Set the title of a parent tab')], 'switch_profile': [True, _('Switch current terminal profile')], + 'switch_profile_all': [False, _('Switch profile of all currently running terminals')], } if __name__ == '__main__': diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index 1651db02..164b17ab 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -290,6 +290,14 @@ class DBusService(Borg, dbus.service.Object): profile_name = options.get('profile') terminal.force_set_profile(False, profile_name) + @dbus.service.method(BUS_NAME) + def switch_profile_all(self, options=dbus.Dictionary()): + """Switch profile of a given terminal""" + for terminal in self.terminator.terminals: + profile_name = options.get('profile') + terminal.force_set_profile(False, profile_name) + + def with_proxy(func): """Decorator function to connect to the session dbus bus""" dbg('dbus client call: %s' % func.__name__) @@ -390,3 +398,7 @@ def switch_profile(session, uuid, options): """Call the dbus method to return the title of a tab""" session.switch_profile(uuid, options) +@with_proxy +def switch_profile_all(session,options): + """Call the dbus method to return the title of a tab""" + session.switch_profile_all(options)