Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add switch_profile_all command to remotinator #471

Merged
merged 1 commit into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions remotinator
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
12 changes: 12 additions & 0 deletions terminatorlib/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ def switch_profile(self, uuid=None, options=dbus.Dictionary()):
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__)
Expand Down Expand Up @@ -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)