diff --git a/doc/terminator.1 b/doc/terminator.1 index a224b530..ccd18b99 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -171,6 +171,13 @@ be displayed. If this is specified and Terminator is already running, DBus will be used to spawn a new tab in the first Terminator window. .RE +.sp +\fB\-\-toggle\-visibility\fP +.RS 4 +If this is specified and Terminator is already running, DBus will be +used to toggle Terminator window visibility. Usable under Wayland to +replace hide keyboad shortcut. +.RE .SH "KEYBINDINGS" .sp The following default keybindings can be used to control Terminator. @@ -347,8 +354,9 @@ of the current one (zoom). .sp \fBCtrl+Shift+Alt+A\fP .RS 4 -Hide the initial window. Note that this is a global binding, and can -only be bound once. +Hide the initial window. Note that this is a X11 global binding, and can +only be bound once. On Wayland use window manager keyboard shortcuts to +call \fBterminator \-\-toggle\-visibility\fP. .RE .SS "Grouping & Broadcasting" .sp diff --git a/doc/terminator.adoc b/doc/terminator.adoc index 92408f13..25ba6c1c 100644 --- a/doc/terminator.adoc +++ b/doc/terminator.adoc @@ -108,6 +108,11 @@ be displayed. If this is specified and Terminator is already running, DBus will be used to spawn a new tab in the first Terminator window. +*--toggle-visibility*:: +If this is specified and Terminator is already running, DBus will be +used to toggle Terminator window visibility. Usable under Wayland to +replace hide keyboad shortcut. + == KEYBINDINGS The following default keybindings can be used to control Terminator. Most of these keybindings can be changed in the Preferences. @@ -221,8 +226,9 @@ Toggle between showing all terminals and only showing a scaled version of the current one (zoom). *Ctrl+Shift+Alt+A*:: -Hide the initial window. Note that this is a global binding, and can -only be bound once. +Hide the initial window. Note that this is a X11 global binding, and can +only be bound once. On Wayland use window manager keyboard shortcuts to +call *terminator --toggle-visibility*. === Grouping & Broadcasting The following items relate to grouping and broadcasting. diff --git a/terminator b/terminator index dcc2fb56..c7ab0e78 100755 --- a/terminator +++ b/terminator @@ -102,6 +102,9 @@ if __name__ == '__main__': if OPTIONS.new_tab: dbg('Requesting a new tab') ipc.new_tab_cmdline(optionslist) + elif OPTIONS.toggle_visibility: + dbg('requesting to toggle windows visibility') + ipc.toggle_visibility_cmdline(optionslist) elif OPTIONS.unhide: print('requesting to unhide windows') ipc.unhide_cmdline(optionslist) diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index 4303f28f..5f30ad99 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -100,6 +100,12 @@ 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 toggle_visibility_cmdline(self,options=dbus.Dictionary): + dbg('toggle_visibility_cmdline') + for window in self.terminator.get_windows(): + window.on_hide_window() + @dbus.service.method(BUS_NAME, in_signature='a{ss}') def unhide_cmdline(self,options=dbus.Dictionary): dbg('unhide_cmdline') @@ -343,6 +349,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 toggle_visibility_cmdline(session,options): + session.toggle_visibility_cmdline(options) + @with_proxy def unhide_cmdline(session,options): session.unhide_cmdline(options) diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index 631e5d3f..da8d0a97 100644 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -96,6 +96,8 @@ icon for the window (by file or name)')) help=_('Comma separated list of methods to limit debugging to')) parser.add_argument('--new-tab', action='store_true', dest='new_tab', help=_('If Terminator is already running, just open a new tab')) + parser.add_argument('--toggle-visibility', action='store_true', dest='toggle_visibility', + help=_('If Terminator is already running, toggle windows visibility')) parser.add_argument('--unhide', action='store_true', dest='unhide', help=_('If Terminator is already running, just unhide all hidden windows')) parser.add_argument('--list-profiles', action='store_true', dest='list_profiles', diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 694b768b..9cf7f688 100644 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -103,6 +103,7 @@ class Window(Container, Gtk.Window): self.apply_icon(icon_to_apply) self.pending_set_rough_geometry_hint = False + self.hidefunc = self.hide def do_get_property(self, prop): """Handle gobject getting a property"""