From fa09ba0cda97a155a0dfbf1e86f32d00106645f3 Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Sun, 12 Sep 2021 22:13:01 +0200 Subject: [PATCH 1/2] Add setting 'disable_mouse_paste' --- terminatorlib/config.py | 1 + terminatorlib/terminal.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index b5363a65..41ee6d5d 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -110,6 +110,7 @@ DEFAULTS = { 'always_split_with_profile': False, 'putty_paste_style' : False, 'putty_paste_style_source_clipboard': False, + 'disable_mouse_paste' : False, 'smart_copy' : True, 'clear_select_on_copy' : False, 'line_height' : 1.0, diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 4b6809ea..b912252d 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -978,9 +978,9 @@ class Terminal(Gtk.VBox): if self.config['putty_paste_style']: middle_click = [self.popup_menu, (widget, event)] - right_click = [self.paste_clipboard, (not self.config['putty_paste_style_source_clipboard'], )] + right_click = [self.paste_clipboard, (not self.config['putty_paste_style_source_clipboard'], True)] else: - middle_click = [self.paste_clipboard, (True, )] + middle_click = [self.paste_clipboard, (True, True)] right_click = [self.popup_menu, (widget, event)] # Ctrl-click event here. @@ -1621,14 +1621,15 @@ class Terminal(Gtk.VBox): webbrowser.open(url) - def paste_clipboard(self, primary=False): + def paste_clipboard(self, primary=False, mouse=False): """Paste one of the two clipboards""" - for term in self.terminator.get_target_terms(self): - if primary: - term.vte.paste_primary() - else: - term.vte.paste_clipboard() - self.vte.grab_focus() + if not (mouse and self.config['disable_mouse_paste']): + for term in self.terminator.get_target_terms(self): + if primary: + term.vte.paste_primary() + else: + term.vte.paste_clipboard() + self.vte.grab_focus() def feed(self, text): """Feed the supplied text to VTE""" From 2251a3489b9387b055c13d45e21d501b56fd66f4 Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Mon, 13 Sep 2021 12:11:01 +0200 Subject: [PATCH 2/2] Implement GUI for disable_mouse_paste --- terminatorlib/preferences.glade | 109 ++++++++++++++++---------------- terminatorlib/prefseditor.py | 8 +++ 2 files changed, 64 insertions(+), 53 deletions(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 42616d93..2e2e1e4f 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -562,7 +562,7 @@ - + True False @@ -679,8 +679,8 @@ 0 - 4 - 3 + 5 + 4 @@ -694,53 +694,6 @@ True - - 0 - 6 - 3 - - - - - True - False - 12 - - - True - False - 12 - - - True - False - Custom URL handler: - 0 - - - False - True - 0 - - - - - True - True - - False - False - - - - True - True - 1 - - - - - 0 7 @@ -808,15 +761,65 @@ 0 - 5 + 6 4 - + + Disable mouse paste + True + True + False + 0.5 + True + + + + 0 + 4 + 4 + - + + True + False + 12 + 12 + + + True + False + Custom URL handler: + + + False + True + 0 + + + + + True + True + + False + False + + + + True + True + 1 + + + + + 0 + 8 + 4 + diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 58dcfc58..c24251f9 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -356,6 +356,9 @@ class PrefsEditor: # Clear selection on copy widget = guiget('clear_select_on_copy') widget.set_active(self.config['clear_select_on_copy']) + # Disable mouse paste + widget = guiget('disable_mouse_paste') + widget.set_active(self.config['disable_mouse_paste']) ## Profile tab # Populate the profile list @@ -842,6 +845,11 @@ class PrefsEditor: self.config['clear_select_on_copy'] = widget.get_active() self.config.save() + def on_disable_mouse_paste_toggled(self, widget): + """Disable mouse paste""" + self.config['disable_mouse_paste'] = widget.get_active() + self.config.save() + def on_cursor_blink_toggled(self, widget): """Cursor blink setting changed""" self.config['cursor_blink'] = widget.get_active()