add switch_profile_all command to remotinator

This commit is contained in:
Matt Rose 2021-07-24 14:15:44 -04:00
parent 27555de35f
commit 550ccf7abf
2 changed files with 13 additions and 0 deletions

View File

@ -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__':

View File

@ -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)