diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index f4fbc015..a0bd3c3e 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -136,6 +136,10 @@ Controls whether splits/tabs will continue to use the profile of their peer term the default profile. Default value: \fBFalse\fR .TP +.B putty_paste_style \fR(boolean) +If set to True, right-click will paste the Primary selection, middle-click will popup the context menu. +Default value: \fBFalse\fR +.TP .B enabled_plugins A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 7fbec4e8..d930e11f 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -123,6 +123,7 @@ DEFAULTS = { 'always_split_with_profile': False, 'title_use_system_font' : True, 'title_font' : 'Sans 9', + 'putty_paste_style' : False, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 8159eabb..d40b4b84 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -576,7 +576,7 @@ True False - 6 + 7 2 12 6 @@ -649,6 +649,22 @@ + + + Putty style paste + True + True + False + False + True + + + + 2 + 2 + 3 + + Re-use profiles for new terminals @@ -662,8 +678,8 @@ 2 - 2 - 3 + 3 + 4 GTK_FILL @@ -680,8 +696,8 @@ 2 - 3 - 4 + 4 + 5 GTK_FILL @@ -732,8 +748,8 @@ 2 - 4 - 5 + 5 + 6 GTK_FILL @@ -751,8 +767,8 @@ 2 - 5 - 6 + 6 + 7 GTK_FILL diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 02de5775..0a623471 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -421,6 +421,9 @@ class PrefsEditor: # Copy on selection widget = guiget('copy_on_selection') widget.set_active(self.config['copy_on_selection']) + # Putty paste style + widget = guiget('putty_paste_style') + widget.set_active(self.config['putty_paste_style']) # Rewrap on resize widget = guiget('rewrap_on_resize_checkbutton') widget.set_active(self.config['rewrap_on_resize']) @@ -710,6 +713,11 @@ class PrefsEditor: self.config['rewrap_on_resize'] = widget.get_active() self.config.save() + def on_putty_paste_style_toggled(self, widget): + """Putty paste style setting changed""" + self.config['putty_paste_style'] = widget.get_active() + self.config.save() + def on_cursor_blink_toggled(self, widget): """Cursor blink setting changed""" self.config['cursor_blink'] = widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index dd777ff2..5ad8a1b6 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -69,6 +69,10 @@ class Terminal(Gtk.VBox): TARGET_TYPE_VTE = 8 + MOUSEBUTTON_LEFT = 1 + MOUSEBUTTON_MIDDLE = 2 + MOUSEBUTTON_RIGHT = 3 + terminator = None vte = None terminalbox = None @@ -918,17 +922,24 @@ class Terminal(Gtk.VBox): # Suppress double-click behavior return True - if event.button == 1: + if self.config['putty_paste_style']: + btn_to_paste = self.MOUSEBUTTON_RIGHT + btn_to_context_menu = self.MOUSEBUTTON_MIDDLE + else: + btn_to_paste = self.MOUSEBUTTON_MIDDLE + btn_to_context_menu = self.MOUSEBUTTON_RIGHT + + if event.button == self.MOUSEBUTTON_LEFT: # Ctrl+leftclick on a URL should open it if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK: url = self.vte.match_check_event(event) if url[0]: self.open_url(url, prepare=True) - elif event.button == 2: + elif event.button == btn_to_paste: # middleclick should paste the clipboard self.paste_clipboard(True) return(True) - elif event.button == 3: + elif event.button == btn_to_context_menu: # rightclick should display a context menu if Ctrl is not pressed, # plus either the app is not interested in mouse events or Shift is pressed if event.get_state() & Gdk.ModifierType.CONTROL_MASK == 0: