From cdb5755193a8a77e84135ff4c9002face2231fd2 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Thu, 26 Nov 2020 15:35:12 -0500 Subject: [PATCH] add a commandline flag to unhide any windows --- terminator | 3 +++ terminatorlib/ipc.py | 11 +++++++++++ terminatorlib/optionparse.py | 3 +++ 3 files changed, 17 insertions(+) diff --git a/terminator b/terminator index 40d52097..fe38748d 100755 --- a/terminator +++ b/terminator @@ -108,6 +108,9 @@ if __name__ == '__main__': if OPTIONS.new_tab: dbg('Requesting a new tab') ipc.new_tab_cmdline(optionslist) + elif OPTIONS.unhide: + print('requesting to unhide windows') + ipc.unhide_cmdline(optionslist) else: dbg('Requesting a new window') ipc.new_window_cmdline(optionslist) diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index 93395874..7e24fb31 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -86,6 +86,13 @@ class DBusService(Borg, dbus.service.Object): window = self.terminator.get_windows()[0] window.tab_new() + @dbus.service.method(BUS_NAME, in_signature='a{ss}') + def unhide_cmdline(self,options=dbus.Dictionary): + dbg('unhide_cmdline') + for window in self.terminator.get_windows(): + if not window.get_property('visible'): + window.on_hide_window() + @dbus.service.method(BUS_NAME) def new_window(self): """Create a new Window""" @@ -216,6 +223,10 @@ def new_tab_cmdline(session, options): """Call the dbus method to open a new tab in the first window""" session.new_tab_cmdline(options) +@with_proxy +def unhide_cmdline(session,options): + session.unhide_cmdline(options) + @with_proxy def new_window(session, options): """Call the dbus method to open a new window""" diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index 8efd242b..822f718a 100644 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -102,6 +102,9 @@ icon for the window (by file or name)')) help=_('Comma separated list of methods to limit debugging to')) parser.add_option('--new-tab', action='store_true', dest='new_tab', help=_('If Terminator is already running, just open a new tab')) + parser.add_option('--unhide', action='store_true', dest='unhide', + help=_('If Terminator is already running, just unhide all hidden windows')) + for item in ['--sm-client-id', '--sm-config-prefix', '--screen', '-n', '--no-gconf' ]: parser.add_option(item, dest='dummy', action='store',