From 042dbfb454e5238f7df4ddb70d6e5b36f9eef713 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 30 Nov 2015 21:39:15 +0100 Subject: [PATCH 1/7] (trunk-1634/1637) Fix the tab switching if a terminal on another tab exits --- ChangeLog | 2 ++ terminatorlib/notebook.py | 5 +++-- terminatorlib/paned.py | 29 +++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4911458..7ee042e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,8 @@ terminator GTK3: Koblinger, LP#1518596) * Fix right-click for mouse aware apps ((Egmont Koblinger, LP#1518700) + * Fix the tab switching if a terminal on another tab exits (Steve + Boddy, LP#943311) terminator 0.97: diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index f45d092e..54bef799 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -40,9 +40,10 @@ class Notebook(Container, Gtk.Notebook): child = window.get_child() window.remove(child) window.add(self) + window_last_active_term = window.last_active_term self.newtab(widget=child) - if window.last_active_term: - self.set_last_active_term(window.last_active_term) + if window_last_active_term: + self.set_last_active_term(window_last_active_term) window.last_active_term = None self.show_all() diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 24cd9d74..9fee0673 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -7,7 +7,7 @@ variants""" import time from gi.repository import GObject, Gtk, Gdk -from util import dbg, err +from util import dbg, err, enumerate_descendants from terminator import Terminator from factory import Factory from container import Container @@ -259,6 +259,26 @@ class Paned(Container): if self.closeterm(widget): # At this point we only have one child, which is the surviving term sibling = self.children[0] + first_term_sibling = sibling + cur_tabnum = None + + focus_sibling = True + if self.get_toplevel().is_child_notebook(): + notebook = self.get_toplevel().get_children()[0] + cur_tabnum = notebook.get_current_page() + tabnum = notebook.page_num_descendant(self) + nth_page = notebook.get_nth_page(tabnum) + exiting_term_was_last_active = (notebook.last_active_term[nth_page] == widget.uuid) + if exiting_term_was_last_active: + first_term_sibling = enumerate_descendants(self)[1][0] + notebook.set_last_active_term(first_term_sibling.uuid) + notebook.clean_last_active_term() + self.get_toplevel().last_active_term = None + if cur_tabnum != tabnum: + focus_sibling = False + elif self.get_toplevel().last_active_term != widget.uuid: + focus_sibling = False + self.remove(sibling) metadata = None @@ -268,7 +288,12 @@ class Paned(Container): parent.remove(self) self.cnxids.remove_all() parent.add(sibling, metadata) - sibling.grab_focus() + if cur_tabnum: + notebook.set_current_page(cur_tabnum) + if focus_sibling: + first_term_sibling.grab_focus() + elif not sibling.get_toplevel().is_child_notebook(): + Terminator().find_terminal_by_uuid(sibling.get_toplevel().last_active_term.urn).grab_focus() else: dbg("Paned::wrapcloseterm: self.closeterm failed") From 9f09d9c3342284a4a4aa3e2512be688cbc8b64c7 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 30 Nov 2015 21:54:23 +0100 Subject: [PATCH 2/7] (trunk-1647) Fix for those not running IBus, where the IBus workaround caused broken keys in other keymaps set with non-IBus tools (New dependancy added (python-psutil) for detecting the IBus process) --- terminator | 9 ++++++++- terminatorlib/terminal.py | 9 +++++---- terminatorlib/terminator.py | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/terminator b/terminator index 37275c0d..0458af39 100755 --- a/terminator +++ b/terminator @@ -20,6 +20,8 @@ import sys import os +import psutil +import pwd try: ORIGCWD = os.getcwd() except OSError: @@ -53,7 +55,11 @@ 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. - os.environ['IBUS_DISABLE_SNOOPER']='1' + username = pwd.getpwuid(os.getuid()).pw_name + ibus_running = [p for p in psutil.process_iter() if p.name == 'ibus-daemon' and p.username == username] + ibus_running = len(ibus_running) > 0 + if ibus_running: + os.environ['IBUS_DISABLE_SNOOPER']='1' dbus_service = None @@ -107,6 +113,7 @@ if __name__ == '__main__': TERMINATOR.set_origcwd(ORIGCWD) 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/terminal.py b/terminatorlib/terminal.py index 71696e49..dd777ff2 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -867,12 +867,13 @@ class Terminal(Gtk.VBox): dbg('Terminal::on_keypress: Called on %s with no event' % widget) return(False) - # Workaround for IBus intefering with broadcast when using dead keys + # Workaround for IBus interfering with broadcast when using dead keys # Environment also needs IBUS_DISABLE_SNOOPER=1, or double chars appear # in the receivers. - if (event.state | Gdk.ModifierType.MODIFIER_MASK ) ^ Gdk.ModifierType.MODIFIER_MASK != 0: - dbg('Terminal::on_keypress: Ingore processed event with event.state %d' % event.state) - return(False) + if self.terminator.ibus_running: + if (event.state | Gdk.ModifierType.MODIFIER_MASK ) ^ Gdk.ModifierType.MODIFIER_MASK != 0: + dbg('Terminal::on_keypress: Ingore processed event with event.state %d' % event.state) + return(False) # FIXME: Does keybindings really want to live in Terminator()? mapping = self.terminator.keybindings.lookup(event) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 47410be3..ac8f3a48 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -48,6 +48,7 @@ class Terminator(Borg): pid_cwd = None gnome_client = None debug_address = None + ibus_running = None doing_layout = None layoutname = None From a04ffed85019d33c9169e3498f9f805702b8b188 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 30 Nov 2015 22:23:23 +0100 Subject: [PATCH 3/7] (trunk-1663) PuTTY paste mode --- doc/terminator_config.5 | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 34 ++++++++++++++++++++++++--------- terminatorlib/prefseditor.py | 8 ++++++++ terminatorlib/terminal.py | 17 ++++++++++++++--- 5 files changed, 52 insertions(+), 12 deletions(-) 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: From 942915dc0845b598dfbd0183513c028e10141140 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 30 Nov 2015 22:28:30 +0100 Subject: [PATCH 4/7] (trunk-1666) Updated and grouped default shortcuts in man page --- doc/terminator.1 | 265 +++++++++++++++++++++++++++-------------------- 1 file changed, 155 insertions(+), 110 deletions(-) diff --git a/doc/terminator.1 b/doc/terminator.1 index 843ce22e..f028933e 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -3,36 +3,36 @@ Terminator \- Multiple GNOME terminals in one window .SH "SYNOPSIS" .B terminator -.RI [ options ] -.br +.RI [ options ] +.br .SH "DESCRIPTION" This manual page documents \fBTerminator\fP, a terminal emulator application. -.PP +.PP \fBTerminator\fP is a program that allows users to set up flexible -arrangements of GNOME terminals. It is aimed at those who normally -arrange lots of terminals near each other, but don't want to use a +arrangements of GNOME terminals. It is aimed at those who normally +arrange lots of terminals near each other, but don't want to use a frame based window manager. .SH "OPTIONS" This program follow the usual GNU command line syntax, with long options starting with two dashes (`\-'). A summary of options is included below. -.TP +.TP .B \-h, \-\-help Show summary of options -.TP +.TP .B \-v, \-\-version Show the version of the Terminator installation .TP .B \-m, \-\-maximise Start with a maximised window -.TP +.TP .B \-f, \-\-fullscreen Start with a fullscreen window -.TP +.TP .B \-b, \-\-borderless -Instruct the window manager not to render borders/decoration on the +Instruct the window manager not to render borders/decoration on the Terminator window (this works well with \-m) -.TP +.TP .B \-H, \-\-hidden Hide the Terminator window by default. Its visibility can be toggled with the \fBhide_window\fR keyboard shortcut (Ctrl-Shift-Alt-a by default) @@ -48,7 +48,7 @@ Specifies the preferred size and position of Terminator's window; see X(7). Runs the specified command instead of your default shell or profile specified command. Note: if Terminator is launched as x-terminal-emulator \-e behaves like \-x, and the longform becomes \-\-execute2=COMMAND -.TP +.TP .B \-x, \-\-execute COMMAND [ARGS] Runs \fBthe rest of the command line\fR instead of your default shell or profile specified command. .TP @@ -78,11 +78,11 @@ Set a custom icon for the window (by file or name) Disable DBus .TP .B \-d, \-\-debug -Enable debugging output (please use this when reporting bugs). This +Enable debugging output (please use this when reporting bugs). This can be specified twice to enable a built-in python debugging server. -.TP +.TP .B \-\-debug\-classes=DEBUG_CLASSES -If this is specified as a comma separated list, debugging output will +If this is specified as a comma separated list, debugging output will only be printed from the specified classes. .TP .B \-\-debug\-methods=DEBUG_METHODS @@ -94,48 +94,43 @@ will be displayed .B \-\-new-tab If this is specified and Terminator is already running, DBus will be used to spawn a new tab in the first Terminator window. -.TP .SH "KEYBINDINGS" -The following keybindings can be used to control Terminator: -.TP -.B Super+R -\fBR\fRotate terminals clockwise. -.TP -.B Super+Shift+R -\fBR\fRotate terminals counter-clockwise. -.TP +The following default keybindings can be used to control Terminator: +.TP +.B F1 +Launches the full HTML manual. +.SS Creation & Destruction +.PP +The following items relate to creating and destroying terminals. +.TP .B Ctrl+Shift+O Split terminals H\fBo\fRrizontally. -.TP +.TP .B Ctrl+Shift+E Split terminals V\fBe\fRrtically. -.TP -.B Ctrl+Shift+Right -Move parent dragbar \fBRight\fR. -.TP -.B Ctrl+Shift+Left -Move parent dragbar \fBLeft\fR. -.TP -.B Ctrl+Shift+Up -Move parent dragbar \fBUp\fR. -.TP -.B Ctrl+Shift+Down -Move parent dragbar \fBDown\fR. -.TP -.B Ctrl+Shift+S -Hide/Show \fBS\fRcrollbar. -.TP -.B Ctrl+Shift+F -Search within terminal scrollback .TP -.B Ctrl+Shift+N or Ctrl+Tab -Move to \fBn\fRext terminal within the same tab, use Ctrl+PageDown to move to the next tab. -If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled -.TP -.B Ctrl+Shift+P or Ctrl+Shift+Tab -Move to \fBp\fRrevious terminal within the same tab, use Ctrl+PageUp to move to the previous tab. -If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled -.TP +.B Ctrl+Shift+T +Open new \fBt\fRab. +.TP +.B Ctrl+Shift+I +Open a new window. (Note: Unlike in previous releases, this window is +part of the same Terminator process.) +.TP +.B Super+I +Spawn a new Terminator process. +.TP +.B Alt+L +Open \fBl\fRayout launcher. +.TP +.B Ctrl+Shift+W +Close the current terminal. +.TP +.B Ctrl+Shift+Q +Close the current window. +.SS Navigation +.PP +The following items relate to moving between and around terminals. +.TP .B Alt+Up Move to the terminal \fBabove\fR the current one. .TP @@ -148,75 +143,40 @@ Move to the terminal \fBleft of\fR the current one. .B Alt+Right Move to the terminal \fBright of\fR the current one. .TP -.B Ctrl+Shift+C -Copy selected text to clipboard -.TP -.B Ctrl+Shift+V -Paste clipboard text -.TP -.B Ctrl+Shift+W -Close the current terminal. -.TP -.B Ctrl+Shift+Q -Quits Terminator -.TP -.B Ctrl+Shift+X -Toggle between showing all terminals and only showing the current one (maximise). -.TP -.B Ctrl+Shift+Z -Toggle between showing all terminals and only showing a scaled version of the current one (zoom). -.TP -.B Ctrl+Shift+T -Open new \fBt\fRab -.TP .B Ctrl+PageDown -Move to next Tab +Move to next Tab. .TP .B Ctrl+PageUp -Move to previous Tab +Move to previous Tab. .TP -.B Ctrl+Shift+PageDown -Swap tab position with next Tab +.B Ctrl+Shift+N or Ctrl+Tab +Move to \fBn\fRext terminal within the same tab, use Ctrl+PageDown to move to the next tab. +If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled. .TP -.B Ctrl+Shift+PageUp -Swap tab position with previous Tab +.B Ctrl+Shift+P or Ctrl+Shift+Tab +Move to \fBp\fRrevious terminal within the same tab, use Ctrl+PageUp to move to the previous tab. +If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled. +.SS Organisation +.PP +The following items relate to arranging and resizing terminals. .TP -.B Ctrl+Plus (+) -Increase font size. \fBNote:\fP this may require you to press shift, depending on your keyboard +.B Ctrl+Shift+Right +Move parent dragbar \fBRight\fR. .TP -.B Ctrl+Minus (-) -Decrease font size. \fBNote:\fP this may require you to press shift, depending on your keyboard +.B Ctrl+Shift+Left +Move parent dragbar \fBLeft\fR. .TP -.B Ctrl+Zero (0) -Restore font size to original setting. +.B Ctrl+Shift+Up +Move parent dragbar \fBUp\fR. .TP -.B F11 -Toggle fullscreen +.B Ctrl+Shift+Down +Move parent dragbar \fBDown\fR. .TP -.B Ctrl+Shift+R -Reset terminal state +.B Super+R +\fBR\fRotate terminals clockwise. .TP -.B Ctrl+Shift+G -Reset terminal state and clear window -.TP -.B Super+g -Group all terminals so that any input sent to one of them, goes to all of them. -.TP -.B Super+Shift+G -Remove grouping from all terminals. -.TP -.B Super+t -Group all terminals in the current tab so input sent to one of them, goes to all terminals in the current tab. -.TP -.B Super+Shift+T -Remove grouping from all terminals in the current tab. -.TP -.B Ctrl+Shift+I -Open a new window (note: unlike in previous releases, this window is -part of the same Terminator process) -.TP -.B Super+i -Spawn a new Terminator process +.B Super+Shift+R +\fBR\fRotate terminals counter-clockwise. .TP .SH "Drag and Drop" The layout can be modified by moving terminals with Drag and Drop. @@ -224,10 +184,95 @@ To start dragging a terminal, click and hold on its titlebar. Alternatively, hold down \fBCtrl\fP, click and hold the \fBright\fP mouse button. Then, \fB**Release Ctrl**\fP. You can now drag the terminal to the point in the layout you would like it to be. The zone where the terminal would be inserted will be highlighted. +.TP +.B Ctrl+Shift+PageDown +Swap tab position with next Tab. +.TP +.B Ctrl+Shift+PageUp +Swap tab position with previous Tab. +.SS Miscellaneous +.PP +The following items relate to miscellaneous terminal related functions. +.TP +.B Ctrl+Shift+C +Copy selected text to clipboard. +.TP +.B Ctrl+Shift+V +Paste clipboard text. +.TP +.B Ctrl+Shift+S +Hide/Show \fBS\fRcrollbar. +.TP +.B Ctrl+Shift+F +Search within terminal scrollback. +.TP +.B Ctrl+Shift+R +Reset terminal state. +.TP +.B Ctrl+Shift+G +Reset terminal state and clear window. +.TP +.B Ctrl+Plus (+) +Increase font size. \fBNote:\fP This may require you to press shift, depending on your keyboard. +.TP +.B Ctrl+Minus (-) +Decrease font size. \fBNote:\fP This may require you to press shift, depending on your keyboard. +.TP +.B Ctrl+Zero (0) +Restore font size to original setting. +.TP +.B Alt+T +Rename titlebar. +.TP +.B Super+1 +Insert terminal number, i.e. 1 to 12. +.TP +.B Super+0 +Insert padded terminal number, i.e. 01 to 12. +.SS Grouping & Broadcasting +.PP +The following items relate to helping to focus on a specific terminal. +.TP +.B F11 +Toggle window to fullscreen. +.TP +.B Ctrl+Shift+X +Toggle between showing all terminals and only showing the current one (maximise). +.TP +.B Ctrl+Shift+Z +Toggle between showing all terminals and only showing a scaled version of the current one (zoom). +.TP +.B Ctrl+Shift+Alt+A +Hide the initial window. Note that this is a global binding, and can only be bound once. +.PP +The following items relate to grouping and broadcasting. +.TP +.B Super+T +Group all terminals in the current tab so input sent to one of them, goes to all terminals in the current tab. +.TP +.B Super+Shift+T +Remove grouping from all terminals in the current tab. +.TP +.B Super+G +Group all terminals so that any input sent to one of them, goes to all of them. +.TP +.B Super+Shift+G +Remove grouping from all terminals. +.TP +.B Alt+A +Broadcast to All terminals. +.TP +.B Alt+G +Broadcast to Grouped terminals. +.TP +.B Alt+O +Broadcast Off. +.PP +Most of these keybindings are changeable in the Preferences. .SH "SEE ALSO" .BR terminator_config(5) .SH "AUTHOR" Terminator was written by Chris Jones and others. -.PP +.PP This manual page was written by Chris Jones and others. From 680cfd2278dfdb9e337451e272e86014eb1db8e6 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 1 Dec 2015 00:14:33 +0100 Subject: [PATCH 5/7] Fix PuTTY paste mode so Ctrl-Right-Drag, and application mouse handling in terminal still works --- terminatorlib/terminal.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 5ad8a1b6..851eb805 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -923,11 +923,11 @@ class Terminal(Gtk.VBox): return True if self.config['putty_paste_style']: - btn_to_paste = self.MOUSEBUTTON_RIGHT - btn_to_context_menu = self.MOUSEBUTTON_MIDDLE + middle_click = [self.popup_menu, (widget, event)] + right_click = [self.paste_clipboard, (True, )] else: - btn_to_paste = self.MOUSEBUTTON_MIDDLE - btn_to_context_menu = self.MOUSEBUTTON_RIGHT + middle_click = [self.paste_clipboard, (True, )] + right_click = [self.popup_menu, (widget, event)] if event.button == self.MOUSEBUTTON_LEFT: # Ctrl+leftclick on a URL should open it @@ -935,19 +935,19 @@ class Terminal(Gtk.VBox): url = self.vte.match_check_event(event) if url[0]: self.open_url(url, prepare=True) - elif event.button == btn_to_paste: + elif event.button == self.MOUSEBUTTON_MIDDLE: # middleclick should paste the clipboard - self.paste_clipboard(True) + middle_click[0](*middle_click[1]) return(True) - elif event.button == btn_to_context_menu: + elif event.button == self.MOUSEBUTTON_RIGHT: # 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: if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0: if not Vte.Terminal.do_button_press_event(self.vte, event): - self.popup_menu(widget, event) + right_click[0](*right_click[1]) else: - self.popup_menu(widget, event) + right_click[0](*right_click[1]) return(True) return(False) From 9115b62928178ce87fe6c57331d39a4bcc3407df Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 1 Dec 2015 00:35:06 +0100 Subject: [PATCH 6/7] (trunk-1667) Added smart copy mode switch to prefs --- doc/terminator_config.5 | 8 +++-- terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 64 ++++++++++++++++++++------------- terminatorlib/prefseditor.py | 14 ++++++-- terminatorlib/terminal.py | 2 ++ 5 files changed, 60 insertions(+), 29 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index a0bd3c3e..f27eb428 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -34,7 +34,7 @@ These are the options Terminator currently supports in the global_config section .TP .B dbus Control whether or not Terminator will load its DBus server. When this server is loaded, running Terminator multiple times will cause the first Terminator process to open additional windows. If this configuration item is set to False, or the python dbus module is unavailable, running Terminator multiple times will run a separate Terminator process for each invocation. -Default value: \fBFalse\fR +Default value: \fBTrue\fR .TP .B focus Control how focus is given to terminals. 'click' means the focus only moves to a terminal after you click in it. 'sloppy' means the focus will follow the mouse pointer. 'system' means the focus will match that used by a GNOME window manager. @@ -46,7 +46,7 @@ Default value: \fB-1\fR .TP .B geometry_hinting If True the window will resize in step with font sizes, if False it will follow pixels -Default value: \fBTrue\fR +Default value: \fBFalse\fR .TP .B window_state When set to 'normal' the Terminator window opens normally. 'maximise' opens the window in a maximised state, 'fullscreen' in a fullscreen state and 'hidden' will make it not shown by default. @@ -140,6 +140,10 @@ Default value: \fBFalse\fR If set to True, right-click will paste the Primary selection, middle-click will popup the context menu. Default value: \fBFalse\fR .TP +.B smart_copy \fR(boolean) +If set to True, and there is no selection, the shortcut is allowed to pass through. This is useful for overloading Ctrl-C to copy a selection, or send the SIGINT to the current process if there is no selection. If False the shortcut does not pass through at all, and the SIGINT does not get sent. +Default value: \fBTrue\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 d930e11f..b77d3feb 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -124,6 +124,7 @@ DEFAULTS = { 'title_use_system_font' : True, 'title_font' : 'Sans 9', 'putty_paste_style' : False, + 'smart_copy' : True, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index d40b4b84..3c668829 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -434,7 +434,7 @@ True False - 6 + 7 2 12 6 @@ -565,6 +565,25 @@ + + + DBus server + True + True + False + False + True + True + + + + 2 + 6 + 7 + GTK_FILL + + + True @@ -665,6 +684,22 @@ 3 + + + Smart copy + True + True + False + False + True + + + + 2 + 3 + 4 + + Re-use profiles for new terminals @@ -678,8 +713,8 @@ 2 - 3 - 4 + 4 + 5 GTK_FILL @@ -696,8 +731,8 @@ 2 - 4 - 5 + 5 + 6 GTK_FILL @@ -746,25 +781,6 @@ - - 2 - 5 - 6 - GTK_FILL - - - - - - DBus server - True - True - False - False - True - True - - 2 6 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 0a623471..832fe8d7 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -289,6 +289,12 @@ class PrefsEditor: #Always split with profile widget = guiget('always_split_with_profile') widget.set_active(self.config['always_split_with_profile']) + # Putty paste style + widget = guiget('putty_paste_style') + widget.set_active(self.config['putty_paste_style']) + # Smart copy + widget = guiget('smart_copy') + widget.set_active(self.config['smart_copy']) #Titlebar font selector # Use system font widget = guiget('title_system_font_checkbutton') @@ -421,9 +427,6 @@ 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']) @@ -718,6 +721,11 @@ class PrefsEditor: self.config['putty_paste_style'] = widget.get_active() self.config.save() + def on_smart_copy_toggled(self, widget): + """Putty paste style setting changed""" + self.config['smart_copy'] = 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 851eb805..6f445405 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -895,6 +895,8 @@ class Terminal(Gtk.VBox): if self.vte.get_has_selection (): getattr(self, "key_" + mapping)() return(True) + elif not self.config['smart_copy']: + return(True) else: getattr(self, "key_" + mapping)() return(True) From 295f884c6dea8e3fa53c50fb0cac8ed2a539aa23 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 1 Dec 2015 00:57:18 +0100 Subject: [PATCH 7/7] (trunk-1683) Merge feature branch for tab/terminal title editing from Haim Daniel --- doc/terminator.1 | 10 ++++++-- doc/terminator_config.5 | 12 ++++++++++ terminatorlib/config.py | 4 +++- terminatorlib/editablelabel.py | 43 +++++++++++++++++++--------------- terminatorlib/notebook.py | 3 +++ terminatorlib/prefseditor.py | 2 ++ terminatorlib/terminal.py | 14 +++++++++++ 7 files changed, 66 insertions(+), 22 deletions(-) diff --git a/doc/terminator.1 b/doc/terminator.1 index f028933e..fbc066fb 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -221,8 +221,14 @@ Decrease font size. \fBNote:\fP This may require you to press shift, depending o .B Ctrl+Zero (0) Restore font size to original setting. .TP -.B Alt+T -Rename titlebar. +.B Ctrl+W +Rename window title. +.TP +.B Ctrl+A +Rename tab title. +.TP +.B Ctrl+X +Rename terminal title. .TP .B Super+1 Insert terminal number, i.e. 1 to 12. diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index f27eb428..3a50b561 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -286,6 +286,18 @@ Note that 1 may need to be provided as ! or similar, depending on your keyboard layout. Default value: \fBUnbound\fR .TP +.B edit_window_title +Edit the current active window's title +Default value: \fBW\fR +.TP +.B edit_tab_title +Edit the currently active tab's title +Default value: \fBA\fR +.TP +.B edit_terminal_title +Edit the currently active terminal's title +Default value: \fBX\fR +.TP .B full_screen Toggle the window to a fullscreen window. Default value: \fBF11\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index b77d3feb..41443c60 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -192,7 +192,9 @@ DEFAULTS = { 'broadcast_all' : 'a', 'insert_number' : '1', 'insert_padded' : '0', - 'edit_window_title': 't', + 'edit_window_title': 'w', + 'edit_tab_title' : 'a', + 'edit_terminal_title': 'x', 'layout_launcher' : 'l', 'next_profile' : '', 'previous_profile' : '', diff --git a/terminatorlib/editablelabel.py b/terminatorlib/editablelabel.py index 9e05714b..7091e0aa 100644 --- a/terminatorlib/editablelabel.py +++ b/terminatorlib/editablelabel.py @@ -25,7 +25,8 @@ class EditableLabel(Gtk.EventBox): # pylint: disable-msg=R0904 """ An eventbox that partialy emulate a Gtk.Label - On double-click, the label is editable, entering an empty will revert back to automatic text + On double-click or key binding the label is editable, entering an empty + will revert back to automatic text """ _label = None _ebox = None @@ -67,30 +68,34 @@ class EditableLabel(Gtk.EventBox): """get the text from the label""" return(self._label.get_text()) + def edit(self): + """ Start editing the widget text """ + if self._entry: + return False + self.remove (self._label) + self._entry = Gtk.Entry () + self._entry.set_text (self._label.get_text ()) + self._entry.show () + self.add (self._entry) + sig = self._entry.connect ("focus-out-event", self._entry_to_label) + self._entry_handler_id.append(sig) + sig = self._entry.connect ("activate", self._on_entry_activated) + self._entry_handler_id.append(sig) + sig = self._entry.connect ("key-press-event", + self._on_entry_keypress) + self._entry_handler_id.append(sig) + sig = self._entry.connect("button-press-event", + self._on_entry_buttonpress) + self._entry_handler_id.append(sig) + self._entry.grab_focus () + def _on_click_text(self, widget, event): # pylint: disable-msg=W0613 """event handling text edition""" if event.button != 1: return False if event.type == Gdk.EventType._2BUTTON_PRESS: - if self._entry: - return False - self.remove (self._label) - self._entry = Gtk.Entry () - self._entry.set_text (self._label.get_text ()) - self._entry.show () - self.add (self._entry) - sig = self._entry.connect ("focus-out-event", self._entry_to_label) - self._entry_handler_id.append(sig) - sig = self._entry.connect ("activate", self._on_entry_activated) - self._entry_handler_id.append(sig) - sig = self._entry.connect ("key-press-event", - self._on_entry_keypress) - self._entry_handler_id.append(sig) - sig = self._entry.connect("button-press-event", - self._on_entry_buttonpress) - self._entry_handler_id.append(sig) - self._entry.grab_focus () + self.edit() return(True) return(False) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 54bef799..27990f19 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -536,6 +536,9 @@ class TabLabel(Gtk.HBox): else: return(None) + def edit(self): + self.label.edit() + def update_button(self): """Update the state of our close button""" if not self.config['close_button_on_tab']: diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 832fe8d7..278df423 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -147,6 +147,8 @@ class PrefsEditor: 'insert_number' : _('Insert terminal number'), 'insert_padded' : _('Insert padded terminal number'), 'edit_window_title': _('Edit window title'), + 'edit_terminal_title': _('Edit terminal title'), + 'edit_tab_title' : _('Edit tab title'), 'layout_launcher' : _('Open layout launcher window'), 'next_profile' : _('Switch to next profile'), 'previous_profile' : _('Switch to previous profile'), diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 6f445405..d42af16c 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1884,6 +1884,20 @@ class Terminal(Gtk.VBox): dialog.destroy() return + def key_edit_tab_title(self): + window = self.get_toplevel() + if not window.is_child_notebook(): + return + + notebook = window.get_children()[0] + n_page = notebook.get_current_page() + page = notebook.get_nth_page(n_page) + label = notebook.get_tab_label(page) + label.edit() + + def key_edit_terminal_title(self): + self.titlebar.label.edit() + def key_layout_launcher(self): LAYOUTLAUNCHER=LayoutLauncher()