From 808d2efaa964633b151ca69d50e71f562f1c41cf Mon Sep 17 00:00:00 2001 From: zpalmtree <22151537+zpalmtree@users.noreply.github.com> Date: Wed, 28 Dec 2022 23:20:28 -0500 Subject: [PATCH] Add detachable tabs feature to preferences --- terminatorlib/config.py | 3 +- terminatorlib/notebook.py | 4 +- terminatorlib/preferences.glade | 130 +++++++++++++++++++------------- terminatorlib/prefseditor.py | 8 ++ 4 files changed, 88 insertions(+), 57 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 80c29cbd..5280e366 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -118,7 +118,8 @@ DEFAULTS = { 'case_sensitive' : True, 'invert_search' : False, 'link_single_click' : False, - 'title_at_bottom' : False + 'title_at_bottom' : False, + 'detachable_tabs' : True, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index f43b88f4..1a069b41 100644 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -191,7 +191,7 @@ class Notebook(Container, Gtk.Notebook): sibling.force_set_profile(None, widget.get_profile()) self.insert_page(container, None, page_num) - self.set_tab_detachable(container, True) + self.set_tab_detachable(container, self.config['detachable_tabs']) self.child_set_property(container, 'tab-expand', True) self.child_set_property(container, 'tab-fill', True) self.set_tab_reorderable(container, True) @@ -320,7 +320,7 @@ class Notebook(Container, Gtk.Notebook): dbg('inserting page at position: %s' % tabpos) self.insert_page(widget, None, tabpos) - self.set_tab_detachable(widget, True) + self.set_tab_detachable(widget, self.config['detachable_tabs']) if maker.isinstance(widget, 'Terminal'): containers, objects = ([], [widget]) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 57dc3620..93137e5c 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1,5 +1,5 @@ - + @@ -413,7 +413,7 @@ 36 True - + True False @@ -553,6 +553,23 @@ 2 + + + Detach tab into new window on drag (Require restart) + False + True + True + False + 0.5 + True + + + + 0 + 7 + 2 + + True @@ -3721,12 +3738,12 @@ - + False + True True - False - filter keybindings + filter keybindings False @@ -3734,68 +3751,73 @@ 0 - - - True - True - adjustment4 - never - in - + True True - True - KeybindingsListStore - False - 0 - - - + adjustment4 + never + in - - Name - - - - 0 - + + True + True + True + KeybindingsListStore + False + 0 + + - - - - - Action - - - 1 - - - - - - - Keybinding - - - True - other - - + + Name + + + + 0 + + + + + + + Action + + + + 1 + + + + + + + Keybinding + + + True + other + + + + + 2 + 3 + + - - 2 - 3 - + + True + True + 1 + - - 3 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index a333069f..2b1c009d 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -770,6 +770,10 @@ class PrefsEditor: else: widget.set_font_name(self.config['title_font']) + # Whether tabs can be detached into their own window by dragging from titlebar + widget = guiget('detachable_tabs') + widget.set_active(self.config['detachable_tabs']) + def set_layout(self, layout_name): """Set a layout""" self.layouteditor.set_layout(layout_name) @@ -1873,6 +1877,10 @@ class PrefsEditor: """Open the fine manual""" self.term.key_help() + def on_detachable_tabs_toggled(self, widget): + self.config['detachable_tabs'] = widget.get_active() + self.config.save() + class LayoutEditor: profile_ids_to_profile = None profile_profile_to_ids = None