Merge pull request #471 from mattrose/switch_profile_all

add switch_profile_all command to remotinator
This commit is contained in:
Matt Rose 2021-07-24 15:05:56 -04:00 committed by GitHub
commit 045e8f57f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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')], 'get_tab_title': [True, _('Get the title of a parent tab')],
'set_tab_title': [True, _('Set 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': [True, _('Switch current terminal profile')],
'switch_profile_all': [False, _('Switch profile of all currently running terminals')],
} }
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -290,6 +290,14 @@ class DBusService(Borg, dbus.service.Object):
profile_name = options.get('profile') profile_name = options.get('profile')
terminal.force_set_profile(False, profile_name) 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): def with_proxy(func):
"""Decorator function to connect to the session dbus bus""" """Decorator function to connect to the session dbus bus"""
dbg('dbus client call: %s' % func.__name__) 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""" """Call the dbus method to return the title of a tab"""
session.switch_profile(uuid, options) 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)