Merge pull request #797 from j-d-r/master

Add command line option --toggle-visibility
This commit is contained in:
Matt Rose 2023-08-26 13:50:45 -04:00 committed by GitHub
commit 00ec42c7d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 4 deletions

View File

@ -171,6 +171,13 @@ be displayed.
If this is specified and Terminator is already running, DBus will be If this is specified and Terminator is already running, DBus will be
used to spawn a new tab in the first Terminator window. used to spawn a new tab in the first Terminator window.
.RE .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" .SH "KEYBINDINGS"
.sp .sp
The following default keybindings can be used to control Terminator. The following default keybindings can be used to control Terminator.
@ -347,8 +354,9 @@ of the current one (zoom).
.sp .sp
\fBCtrl+Shift+Alt+A\fP \fBCtrl+Shift+Alt+A\fP
.RS 4 .RS 4
Hide the initial window. Note that this is a global binding, and can Hide the initial window. Note that this is a X11 global binding, and can
only be bound once. only be bound once. On Wayland use window manager keyboard shortcuts to
call \fBterminator \-\-toggle\-visibility\fP.
.RE .RE
.SS "Grouping & Broadcasting" .SS "Grouping & Broadcasting"
.sp .sp

View File

@ -108,6 +108,11 @@ be displayed.
If this is specified and Terminator is already running, DBus will be If this is specified and Terminator is already running, DBus will be
used to spawn a new tab in the first Terminator window. 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 == KEYBINDINGS
The following default keybindings can be used to control Terminator. The following default keybindings can be used to control Terminator.
Most of these keybindings can be changed in the Preferences. 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). of the current one (zoom).
*Ctrl+Shift+Alt+A*:: *Ctrl+Shift+Alt+A*::
Hide the initial window. Note that this is a global binding, and can Hide the initial window. Note that this is a X11 global binding, and can
only be bound once. only be bound once. On Wayland use window manager keyboard shortcuts to
call *terminator --toggle-visibility*.
=== Grouping & Broadcasting === Grouping & Broadcasting
The following items relate to grouping and broadcasting. The following items relate to grouping and broadcasting.

View File

@ -102,6 +102,9 @@ if __name__ == '__main__':
if OPTIONS.new_tab: if OPTIONS.new_tab:
dbg('Requesting a new tab') dbg('Requesting a new tab')
ipc.new_tab_cmdline(optionslist) ipc.new_tab_cmdline(optionslist)
elif OPTIONS.toggle_visibility:
dbg('requesting to toggle windows visibility')
ipc.toggle_visibility_cmdline(optionslist)
elif OPTIONS.unhide: elif OPTIONS.unhide:
print('requesting to unhide windows') print('requesting to unhide windows')
ipc.unhide_cmdline(optionslist) ipc.unhide_cmdline(optionslist)

View File

@ -100,6 +100,12 @@ class DBusService(Borg, dbus.service.Object):
window = self.terminator.get_windows()[0] window = self.terminator.get_windows()[0]
window.tab_new() 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}') @dbus.service.method(BUS_NAME, in_signature='a{ss}')
def unhide_cmdline(self,options=dbus.Dictionary): def unhide_cmdline(self,options=dbus.Dictionary):
dbg('unhide_cmdline') 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""" """Call the dbus method to open a new tab in the first window"""
session.new_tab_cmdline(options) session.new_tab_cmdline(options)
@with_proxy
def toggle_visibility_cmdline(session,options):
session.toggle_visibility_cmdline(options)
@with_proxy @with_proxy
def unhide_cmdline(session,options): def unhide_cmdline(session,options):
session.unhide_cmdline(options) session.unhide_cmdline(options)

View File

@ -96,6 +96,8 @@ icon for the window (by file or name)'))
help=_('Comma separated list of methods to limit debugging to')) help=_('Comma separated list of methods to limit debugging to'))
parser.add_argument('--new-tab', action='store_true', dest='new_tab', parser.add_argument('--new-tab', action='store_true', dest='new_tab',
help=_('If Terminator is already running, just open a 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', parser.add_argument('--unhide', action='store_true', dest='unhide',
help=_('If Terminator is already running, just unhide all hidden windows')) help=_('If Terminator is already running, just unhide all hidden windows'))
parser.add_argument('--list-profiles', action='store_true', dest='list_profiles', parser.add_argument('--list-profiles', action='store_true', dest='list_profiles',

View File

@ -103,6 +103,7 @@ class Window(Container, Gtk.Window):
self.apply_icon(icon_to_apply) self.apply_icon(icon_to_apply)
self.pending_set_rough_geometry_hint = False self.pending_set_rough_geometry_hint = False
self.hidefunc = self.hide
def do_get_property(self, prop): def do_get_property(self, prop):
"""Handle gobject getting a property""" """Handle gobject getting a property"""