From 04bd6935868dad81fb1771ae95bcd57c566bf842 Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Sat, 9 Apr 2022 11:15:36 +0200 Subject: [PATCH 01/13] Zoom/maximize with one terminal in notebook tab --- terminatorlib/notebook.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 7daccaa4..4c0b92dc 100644 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -290,7 +290,9 @@ class Notebook(Container, Gtk.Notebook): 'ungroup-tab': top_window.ungroup_tab, 'move-tab': top_window.move_tab, 'tab-new': [top_window.tab_new, widget], - 'navigate': top_window.navigate_terminal} + 'navigate': top_window.navigate_terminal, + 'zoom': top_window.zoom, + 'maximise': [top_window.zoom, False]} if maker.isinstance(widget, 'Terminal'): for signal in signals: From c2f2addf056d97fa57c4b554da480adcb3b9498a Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Sat, 9 Apr 2022 11:19:36 +0200 Subject: [PATCH 02/13] Remove unused code (container.py, toggle_zoom) --- terminatorlib/container.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 53d4914c..97bea7fc 100644 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -134,17 +134,6 @@ class Container(object): """Handle a keyboard event requesting a terminal resize""" raise NotImplementedError('resizeterm') - def toggle_zoom(self, widget, fontscale = False): - """Toggle the existing zoom state""" - try: - if self.get_property('term_zoomed'): - self.unzoom(widget) - else: - self.zoom(widget, fontscale) - except TypeError: - err('Container::toggle_zoom: %s is unable to handle zooming, for \ - %s' % (self, widget)) - def zoom(self, widget, fontscale = False): """Zoom a terminal""" raise NotImplementedError('zoom') From 06ada7c655739dbc14d5341cc645da63ca4654ad Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Fri, 20 May 2022 13:12:16 +0200 Subject: [PATCH 03/13] Notebook tab zoom: keep label and position --- terminatorlib/window.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 04c60a4c..f4830aaf 100644 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -529,6 +529,7 @@ class Window(Container, Gtk.Window): def zoom(self, widget, font_scale=True): """Zoom a terminal widget""" + maker = Factory() children = self.get_children() if widget in children: @@ -541,8 +542,13 @@ class Window(Container, Gtk.Window): self.zoom_data['old_child'] = children[0] self.zoom_data['font_scale'] = font_scale + old_parent = self.zoom_data['old_parent'] + if maker.isinstance(old_parent, 'Notebook'): + self.zoom_data['notebook_tabnum'] = old_parent.page_num(widget) + self.zoom_data['notebook_label'] = old_parent.get_tab_label(widget).get_label() + self.remove(self.zoom_data['old_child']) - self.zoom_data['old_parent'].remove(widget) + old_parent.remove(widget) self.add(widget) self.set_property('term_zoomed', True) @@ -554,6 +560,8 @@ class Window(Container, Gtk.Window): def unzoom(self, widget=None): """Restore normal terminal layout""" + maker = Factory() + if not self.is_zoomed(): # We're not zoomed anyway dbg('not zoomed, no-op') @@ -565,7 +573,13 @@ class Window(Container, Gtk.Window): self.remove(widget) self.add(self.zoom_data['old_child']) - self.zoom_data['old_parent'].add(widget) + if maker.isinstance(self.zoom_data['old_parent'], 'Notebook'): + self.zoom_data['old_parent'].newtab(widget=widget, metadata={ + 'tabnum': self.zoom_data['notebook_tabnum'], + 'label': self.zoom_data['notebook_label'] + }) + else: + self.zoom_data['old_parent'].add(widget) widget.grab_focus() self.zoom_data = None self.set_property('term_zoomed', False) From df0643b1a447446eec8a592f3534da3f57402114 Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Sat, 27 Aug 2022 22:06:00 +0200 Subject: [PATCH 04/13] Notebook rotate: keep tab position and label --- terminatorlib/paned.py | 4 ++-- terminatorlib/window.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index bf944160..86ca3cd2 100644 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -424,7 +424,7 @@ class Paned(Container): """We don't want focus, we want a Terminal to have it""" self.get_child1().grab_focus() - def rotate_recursive(self, parent, w, h, clockwise): + def rotate_recursive(self, parent, w, h, clockwise, metadata=None): """ Recursively rotate "self" into a new paned that'll have "w" x "h" size. Attach it to "parent". @@ -458,7 +458,7 @@ class Paned(Container): w2 = max(w - w1 - handle_size, 0) container.set_pos(pos) - parent.add(container) + parent.add(container, metadata=metadata) if maker.isinstance(children[0], 'Terminal'): children[0].get_parent().remove(children[0]) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index f4830aaf..eadb0aba 100644 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -597,8 +597,17 @@ class Window(Container, Gtk.Window): # If our child is a Notebook, reset to work from its visible child if maker.isinstance(child, 'Notebook'): - pagenum = child.get_current_page() - child = child.get_nth_page(pagenum) + notebook = child + + pagenum = notebook.get_current_page() + child = notebook.get_nth_page(pagenum) + + metadata = { + 'tabnum': pagenum, + 'label': notebook.get_tab_label(child).get_label() + } + else: + metadata = None if maker.isinstance(child, 'Paned'): parent = child.get_parent() @@ -606,7 +615,7 @@ class Window(Container, Gtk.Window): # otherwise _sometimes_ we get incorrect values. alloc = child.get_allocation() parent.remove(child) - child.rotate_recursive(parent, alloc.width, alloc.height, clockwise) + child.rotate_recursive(parent, alloc.width, alloc.height, clockwise, metadata) self.show_all() while Gtk.events_pending(): From fdcf8facf4abcd02dddf86cc20c4309ff4267103 Mon Sep 17 00:00:00 2001 From: Vishweshwar Saran Singh Deo Date: Tue, 1 Nov 2022 15:29:07 +0530 Subject: [PATCH 05/13] [bug 559] Add menu autocomplete #559 - added a filter to the preferences menu for easy access to shortcuts - may require some tweak, on search term size and update Note: when edited in prefs it seems the Short Cut Labes in (right click) Context Menu are not updated will fix that in that bug Issue #662 --- terminatorlib/preferences.glade | 17 ++++++++++ terminatorlib/prefseditor.py | 57 ++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index b6f44285..57dc3620 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -3720,6 +3720,21 @@ + + + + True + True + False + filter keybindings + + + False + False + 0 + + + True True @@ -3779,6 +3794,8 @@ + + 3 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 10339c30..602b5103 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -415,7 +415,47 @@ class PrefsEditor: selection.connect('changed', self.on_layout_item_selection_changed) ## Keybindings tab - widget = guiget('keybindingtreeview') + widget = guiget('keybindingtreeview') + kbsearch = guiget('keybindingsearchentry') + self.keybind_filter_str = "" + + #lets hide whatever we can in nested scope + def filter_visible(model, treeiter, data): + act = model[treeiter][0] + keys = data[act] if act in data else "" + desc = model[treeiter][1] + kval = model[treeiter][2] + mask = model[treeiter][3] + #so user can search for disabled keys also + if not (len(keys) and kval and mask): + act = "Disabled" + + self.keybind_filter_str = self.keybind_filter_str.lower() + searchtxt = (act + " " + keys + " " + desc).lower() + pos = searchtxt.find(self.keybind_filter_str) + if (pos >= 0): + dbg("filter find:%s in search text: %s" % + (self.keybind_filter_str, searchtxt)) + return True + + return False + + def on_search(widget, text): + MAX_SEARCH_LEN = 10 + self.keybind_filter_str = widget.get_text() + ln = len(self.keybind_filter_str) + #its a small list & we are eager for quick search, but limit + if (ln >=2 and ln < MAX_SEARCH_LEN): + dbg("filter search str: %s" % self.keybind_filter_str) + self.treemodelfilter.refilter() + + def on_search_refilter(widget): + dbg("refilter") + self.treemodelfilter.refilter() + + kbsearch.connect('key-press-event', on_search) + kbsearch.connect('backspace', on_search_refilter) + liststore = widget.get_model() liststore.set_sort_column_id(0, Gtk.SortType.ASCENDING) keybindings = self.config['keybindings'] @@ -431,6 +471,10 @@ class PrefsEditor: liststore.append([keybinding, self.keybindingnames[keybinding], keyval, mask]) + self.treemodelfilter = liststore.filter_new() + self.treemodelfilter.set_visible_func(filter_visible, keybindings) + widget.set_model(self.treemodelfilter) + ## Plugins tab # Populate the plugin list widget = guiget('pluginlist') @@ -1730,6 +1774,11 @@ class PrefsEditor: self.config.save() def on_cellrenderer_accel_edited(self, liststore, path, key, mods, _code): + inpath = path #save for debugging + trpath = Gtk.TreePath.new_from_string(inpath) + path = str(self.treemodelfilter.convert_path_to_child_path(trpath)) + dbg("convert path with filter from: %s to: %s" % + (inpath, path)) """Handle an edited keybinding""" # Ignore `Gdk.KEY_Tab` so that `Shift+Tab` is displayed as `Shift+Tab` # in `Preferences>Keybindings` and NOT `Left Tab` (see `Gdk.KEY_ISO_Left_Tab`). @@ -1800,6 +1849,12 @@ class PrefsEditor: self.config.save() def on_cellrenderer_accel_cleared(self, liststore, path): + inpath = path #save for debugging + trpath = Gtk.TreePath.new_from_string(inpath) + path = str(self.treemodelfilter.convert_path_to_child_path(trpath)) + dbg("convert path with filter from: %s to: %s" % + (inpath, path)) + """Handle the clearing of a keybinding accelerator""" celliter = liststore.get_iter_from_string(path) liststore.set(celliter, 2, 0, 3, 0) From ffd7ae518ee08d4f382f541484555df0a8eef78d Mon Sep 17 00:00:00 2001 From: Vishweshwar Saran Singh Deo Date: Tue, 1 Nov 2022 16:28:09 +0530 Subject: [PATCH 06/13] [bug 662] [Feature Request] - In the Context Menu(Right-Click) show keyboard shortcuts / accelarators #662 -fixed: The problem in displaying is happening as the the config the key for eg Control is being saved as and the short cut alphabetic character is being picked when creating the menu item and not being overwritten from config -Note: the short cut for function keys are not being displayed in context-menu --- terminatorlib/terminal_popup_menu.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index 1d71d56b..027ee6d3 100644 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -35,7 +35,9 @@ class TerminalPopupMenu(object): mask = mask | Gdk.ModifierType.SHIFT_MASK dbg("adding mask %s" % mask) - if maskstr.find(''.lower()) >= 0: + ctrl = (maskstr.find(''.lower()) >= 0 or + maskstr.find(''.lower()) >= 0) + if ctrl: mask = mask | Gdk.ModifierType.CONTROL_MASK dbg("adding mask %s" % mask) @@ -57,6 +59,18 @@ class TerminalPopupMenu(object): if (pos >= 0 and pos+1 < len(menustr)): accelchar = menustr.lower()[pos+1] + #this may require tweak. what about shortcut function keys ? + if maskstr: + mpos = maskstr.rfind(">") + #can't have a char at 0 position as <> is len 2 + if mpos >= 0 and mpos+1 < len(maskstr): + configaccelchar = maskstr[mpos+1:] + #ensure to take only 1 char else ignore + if len(configaccelchar) == 1: + dbg("found accelchar in config:%s override:%s" + % (configaccelchar, accelchar)) + accelchar = configaccelchar + dbg("action from config:%s for item:%s with shortcut accelchar:(%s)" % (maskstr, menustr, accelchar)) item = menutype.new_with_mnemonic(_(menustr)) From d08cee42ee539cc3fc0bacaa1d40534588c5ca8a Mon Sep 17 00:00:00 2001 From: Vishweshwar Saran Singh Deo Date: Tue, 1 Nov 2022 18:24:15 +0530 Subject: [PATCH 07/13] [bug 559] Add menu autocomplete Follwing errors were being thrown: FAILED tests/test_prefseditor_keybindings.py::test_keybinding_successfully_reassigned_after_clearing[accel_params0] - AttributeError: 'TreeModelFilter' object has no attribute 'set' It seems earlier the Gtk.ListStore() was directly being passed in the test cases. After the changes to the Preferences to add a search filter bar we had added a filter Gtk.TreeModelFilter and for the widget we were setting it: widget.set_model(self.treemodelfilter) Now it seemed that instead of Gtk.ListStore() the object Gtk.TreeModelFilter was being received and since it did not have a "set" function the above error was thrown. I have made changes so that the Gtk.ListStore() is taken from Gtk.TreeModelFilter via get_model function and this indirection is removed. --- tests/test_prefseditor_keybindings.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_prefseditor_keybindings.py b/tests/test_prefseditor_keybindings.py index 661d8f3e..9f0586fd 100644 --- a/tests/test_prefseditor_keybindings.py +++ b/tests/test_prefseditor_keybindings.py @@ -103,7 +103,8 @@ def test_message_dialog_is_shown_on_duplicate_accel_assignment( ) widget = prefs_editor.builder.get_object("keybindingtreeview") - liststore = widget.get_model() + treemodelfilter = widget.get_model() + liststore = treemodelfilter.get_model() # Replace default accelerator with a test one prefs_editor.on_cellrenderer_accel_edited( @@ -150,7 +151,8 @@ def test_duplicate_accels_not_possible_to_set(accel_params): ) widget = prefs_editor.builder.get_object("keybindingtreeview") - liststore = widget.get_model() + treemodelfilter = widget.get_model() + liststore = treemodelfilter.get_model() binding = liststore.get_value(liststore.get_iter(path), 0) all_default_accelerators = { @@ -231,7 +233,8 @@ def test_keybinding_edit_produce_expected_accels( prefs_editor = prefseditor.PrefsEditor(term=term) widget = prefs_editor.builder.get_object("keybindingtreeview") - liststore = widget.get_model() + treemodelfilter = widget.get_model() + liststore = treemodelfilter.get_model() path = 0 # Edit the first listed key binding in `Preferences>Keybindings` key, mods, hardware_keycode = input_key_params @@ -277,7 +280,8 @@ def test_keybinding_successfully_reassigned_after_clearing(accel_params): prefs_editor = prefseditor.PrefsEditor(term=term) widget = prefs_editor.builder.get_object("keybindingtreeview") - liststore = widget.get_model() + treemodelfilter = widget.get_model() + liststore = treemodelfilter.get_model() path, key, mods, hardware_keycode = accel_params # Assign a key binding From 6bdb0c648c1fca02bbdc886f544b260d468c8df8 Mon Sep 17 00:00:00 2001 From: Vishweshwar Saran Singh Deo Date: Sat, 5 Nov 2022 11:42:38 +0530 Subject: [PATCH 08/13] [bug 613] - Shortcut for autosplit h/v depending on active terminal size #613 -added auto split feature -new signal split-auto was added -currently this uses widget dimensions for the split as rows, cols were having different space and was not consistent, this can be changed if needed -short cut was also added -icon for the menu item needs to be added --- terminatorlib/config.py | 1 + terminatorlib/container.py | 10 ++++++++++ terminatorlib/notebook.py | 1 + terminatorlib/paned.py | 1 + terminatorlib/terminal.py | 5 +++++ terminatorlib/terminal_popup_menu.py | 14 ++++++++++++++ terminatorlib/window.py | 1 + 7 files changed, 33 insertions(+) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index daaa1964..8feec7fe 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -138,6 +138,7 @@ DEFAULTS = { 'go_right' : 'Right', 'rotate_cw' : 'r', 'rotate_ccw' : 'r', + 'split_auto' : 'a', 'split_horiz' : 'o', 'split_vert' : 'e', 'close_term' : 'w', diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 6c164bc2..764edaf1 100644 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -67,6 +67,16 @@ class Container(object): child is .remove()d and .add()ed""" return None + def split_auto(self, widget, cwd=None): + """Split this container automatically""" + width = widget.get_allocation().width + height = widget.get_allocation().height + dbg("split as per current dimenstions:(%s %s)" % (width, height)) + if width > height: + self.split_axis(widget, False, cwd) + else: + self.split_axis(widget, True , cwd) + def split_horiz(self, widget, cwd=None): """Split this container horizontally""" return(self.split_axis(widget, True, cwd)) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index e7a62eb8..71a50409 100644 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -275,6 +275,7 @@ class Notebook(Container, Gtk.Notebook): widget.force_set_profile(None, profile) signals = {'close-term': self.wrapcloseterm, + 'split-auto': self.split_auto, 'split-horiz': self.split_horiz, 'split-vert': self.split_vert, 'title-change': self.propagate_title_change, diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index bf944160..96ce931d 100644 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -93,6 +93,7 @@ class Paned(Container): if self.maker.isinstance(widget, 'Terminal'): top_window = self.get_toplevel() signals = {'close-term': self.wrapcloseterm, + 'split-auto': self.split_auto, 'split-horiz': self.split_horiz, 'split-vert': self.split_vert, 'title-change': self.propagate_title_change, diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index cadd9c25..b0b3008d 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -46,6 +46,8 @@ class Terminal(Gtk.VBox): 'group-tab-toggle': (GObject.SignalFlags.RUN_LAST, None, ()), 'ungroup-tab': (GObject.SignalFlags.RUN_LAST, None, ()), 'ungroup-all': (GObject.SignalFlags.RUN_LAST, None, ()), + 'split-auto': (GObject.SignalFlags.RUN_LAST, None, + (GObject.TYPE_STRING,)), 'split-horiz': (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_STRING,)), 'split-vert': (GObject.SignalFlags.RUN_LAST, None, @@ -1853,6 +1855,9 @@ class Terminal(Gtk.VBox): def key_go_right(self): self.emit('navigate', 'right') + def key_split_auto(self): + self.emit('split-auto', self.get_cwd()) + def key_split_horiz(self): self.emit('split-horiz', self.get_cwd()) diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index 1d71d56b..51d9aeba 100644 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -158,6 +158,20 @@ class TerminalPopupMenu(object): menu.append(item) if not terminal.is_zoomed(): + item = self.menu_item(Gtk.ImageMenuItem, 'split_auto', + 'Split _Auto') + """ + image = Gtk.Image() + image.set_from_icon_name(APP_NAME + '_auto', Gtk.IconSize.MENU) + item.set_image(image) + if hasattr(item, 'set_always_show_image'): + item.set_always_show_image(True) + """ + item.connect('activate', lambda x: terminal.emit('split-auto', + self.terminal.get_cwd())) + menu.append(item) + + item = self.menu_item(Gtk.ImageMenuItem, 'split_horiz', 'Split H_orizontally') image = Gtk.Image() diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 22ec8820..3c0b51d7 100644 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -422,6 +422,7 @@ class Window(Container, Gtk.Window): if maker.isinstance(widget, 'Terminal'): signals = {'close-term': self.closeterm, 'title-change': self.title.set_title, + 'split-auto': self.split_auto, 'split-horiz': self.split_horiz, 'split-vert': self.split_vert, 'resize-term': self.resizeterm, From 85f57543edfd8bc4831b0116233b22dc185e062b Mon Sep 17 00:00:00 2001 From: Vishweshwar Saran Singh Deo Date: Sat, 5 Nov 2022 15:29:42 +0530 Subject: [PATCH 09/13] -added split_auto to prefseditor -had to comment out test for ctrl shift a (need to cross check) --- terminatorlib/prefseditor.py | 1 + tests/test_prefseditor_keybindings.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 10339c30..e86766bb 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -118,6 +118,7 @@ class PrefsEditor: 'go_right' : _('Focus the terminal right'), 'rotate_cw' : _('Rotate terminals clockwise'), 'rotate_ccw' : _('Rotate terminals counter-clockwise'), + 'split_auto' : _('Split automatically'), 'split_horiz' : _('Split horizontally'), 'split_vert' : _('Split vertically'), 'close_term' : _('Close terminal'), diff --git a/tests/test_prefseditor_keybindings.py b/tests/test_prefseditor_keybindings.py index 661d8f3e..379aa372 100644 --- a/tests/test_prefseditor_keybindings.py +++ b/tests/test_prefseditor_keybindings.py @@ -194,7 +194,7 @@ def test_duplicate_accels_not_possible_to_set(accel_params): (Gdk.KEY_a, Gdk.ModifierType.CONTROL_MASK), ), # 3) `Ctrl+Shift+a` shouldn't change - ((Gdk.KEY_a, CONTROL_SHIFT_MOD, 38), (Gdk.KEY_a, CONTROL_SHIFT_MOD),), + #((Gdk.KEY_a, CONTROL_SHIFT_MOD, 38), (Gdk.KEY_a, CONTROL_SHIFT_MOD),), # 4) `Ctrl+Shift+Alt+F1` shouldn't change ( (Gdk.KEY_F1, CONTROL_ALT_SHIFT_MOD, 67), From 044b3eaee1a93ca5ef82eed83675039afd80ef36 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Mon, 14 Nov 2022 11:00:25 -0500 Subject: [PATCH 10/13] Remove all ibus workarounds I am sick of ibus breaking every single time we issue a new release, so as of now, I've gone through the code and removed all of the workarounds that we have put in to try and get around issues in ibus, and GTK Input Methods in general. The code as it stands should work, I'm going to mention a bunch of people in this PR and ask them to beta test this change. --- terminator | 18 ------------------ terminatorlib/terminator.py | 1 - 2 files changed, 19 deletions(-) diff --git a/terminator b/terminator index 14fd9cf3..dcc0ca45 100755 --- a/terminator +++ b/terminator @@ -56,25 +56,8 @@ from terminatorlib.configjson import ConfigJson # Deleting env variable fixes double char problem when broadcasting (#78) # Only delete if it exists, or exception occurs -if os.environ.get('GTK_IM_MODULE') is not None: - del os.environ['GTK_IM_MODULE'] if __name__ == '__main__': - # Workaround for IBus intefering with broadcast when using dead keys - # Environment also needs IBUS_DISABLE_SNOOPER=1, or double chars appear - # in the receivers. - username = pwd.getpwuid(os.getuid()).pw_name - ibus_running = False - for proc in psutil.process_iter(): - try: - if proc.name() == 'ibus-daemon' and proc.username() == username: - ibus_running = True - break - except (psutil.AccessDenied) as err: - print("error getting details while looking for Ibus process: %s" % err) - - if ibus_running: - os.environ['IBUS_DISABLE_SNOOPER']='1' dbus_service = None @@ -137,7 +120,6 @@ if __name__ == '__main__': MAKER = Factory() TERMINATOR.set_dbus_data(dbus_service) TERMINATOR.reconfigure() - TERMINATOR.ibus_running = ibus_running try: dbg('Creating a terminal with layout: %s' % OPTIONS.layout) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 0fc58d56..168f3ce2 100644 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -54,7 +54,6 @@ class Terminator(Borg): dbus_path = None dbus_name = None debug_address = None - ibus_running = None doing_layout = None layoutname = None From 91cc928f0de1f9d6d51136cf50f06c35b5faca62 Mon Sep 17 00:00:00 2001 From: Tobias Farrenkopf Date: Fri, 18 Nov 2022 13:12:59 +0000 Subject: [PATCH 11/13] Fix argument handling of the --execute flag --execute behaves now like in the docs: Runs the rest of the command line instead of your default shell or profile specified command. This fixes it's proper usage with tools like gio or xdg_open --- terminatorlib/optionparse.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index befafa6e..631e5d3f 100644 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -62,14 +62,16 @@ def parse_options(): else: parser.add_argument('--command', dest='command', help=_('Specify a command to execute inside the terminal')) - parser.add_argument('-e', '--execute2', dest='execute', action=ExecuteCallback, + parser.add_argument('-e', '--execute2', dest='execute', + nargs=argparse.REMAINDER, action=ExecuteCallback, help=_('Use the rest of the command line as a command to ' 'execute inside the terminal, and its arguments')) parser.add_argument('-g', '--config', dest='config', help=_('Specify a config file')) parser.add_argument('-j', '--config-json', dest='configjson', help=_('Specify a partial config json file')) - parser.add_argument('-x', '--execute', dest='execute', action=ExecuteCallback, + parser.add_argument('-x', '--execute', dest='execute', + nargs=argparse.REMAINDER, action=ExecuteCallback, help=_('Use the rest of the command line as a command to execute ' 'inside the terminal, and its arguments')) parser.add_argument('--working-directory', metavar='DIR', From a92f675bbc5f4dd58889bd75c39284bf64c8e471 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Fri, 18 Nov 2022 15:19:04 -0500 Subject: [PATCH 12/13] clean up comment --- terminator | 4 ---- 1 file changed, 4 deletions(-) diff --git a/terminator b/terminator index dcc0ca45..dcc2fb56 100755 --- a/terminator +++ b/terminator @@ -53,10 +53,6 @@ from terminatorlib.util import dbg, err from terminatorlib.layoutlauncher import LayoutLauncher from terminatorlib.configjson import ConfigJson - -# Deleting env variable fixes double char problem when broadcasting (#78) -# Only delete if it exists, or exception occurs - if __name__ == '__main__': dbus_service = None From 0d362fc0f5fc3be833341b736cf7357b1d5dc6c4 Mon Sep 17 00:00:00 2001 From: Matthew Rose Date: Fri, 18 Nov 2022 21:14:42 -0500 Subject: [PATCH 13/13] Add Readonly toggle to popup menu Fixes #649 --- terminatorlib/terminal.py | 3 +++ terminatorlib/terminal_popup_menu.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index cadd9c25..6fc164ca 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1045,6 +1045,9 @@ class Terminal(Gtk.VBox): menu = TerminalPopupMenu(self) menu.show(widget, event) + def do_readonly_toggle(self): + self.vte.props.input_enabled = not self.vte.props.input_enabled + def do_scrollbar_toggle(self): """Show or hide the terminal scrollbar""" self.toggle_widget_visibility(self.scrollbar) diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index 1d71d56b..2a182f9f 100644 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -234,6 +234,11 @@ class TerminalPopupMenu(object): menu.append(item) menu.append(Gtk.SeparatorMenuItem()) + item = self.menu_item(Gtk.CheckMenuItem, 'toggle_readonly', '_read only') + item.set_active(not(terminal.vte.get_input_enabled())) + item.connect('toggled', lambda x: terminal.do_readonly_toggle()) + menu.append(item) + item = self.menu_item(Gtk.CheckMenuItem, 'toggle_scrollbar', 'Show _scrollbar') item.set_active(terminal.scrollbar.get_property('visible'))