diff --git a/ChangeLog b/ChangeLog index b30c0830..391d253b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,12 @@ terminator GTK3: LP#1518557) * Change the scroll_on_output default to false (Egmont Koblinger, LP#1392822) + * PuTTY paste mode (Nemilya, LP#1416682) with some alterations + (Steve Boddy) + * Updated and grouped default shortcuts in man page (Steve Boddy) + * Added smart copy mode switch to prefs (Steve Boddy, LP#1223129) + * Merge feature branch for tab/terminal title editing (Haim + Daniel LP#1417747) Bug fixes * Fix a GI version warning for Notify library (Mattias Eriksson) @@ -49,6 +55,13 @@ terminator GTK3: * Remove unsupported utmp for now, till alternative solution * Fix the "Run command as login shell" (Egmont Koblinger, LP#1520991) + * Fix the tab switching if a terminal on another tab exits (Steve + Boddy, LP#943311) + * Fix for those not running IBus, where the IBus workaround + caused broken keys in other keymaps set with non-IBus tools + (Steve Boddy, LP#1494606) + * Fix PuTTY paste mode so Ctrl-Right-Drag, and application mouse + handling in terminal still works (Steve Boddy) terminator 0.97: * Allow font dimming in inactive terminals diff --git a/doc/terminator.1 b/doc/terminator.1 index 843ce22e..fbc066fb 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,101 @@ 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 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. +.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. diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 7bb22a17..75510d8a 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. @@ -136,6 +136,14 @@ 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 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 @@ -278,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/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/config.py b/terminatorlib/config.py index 930b30b6..0c74173c 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -123,6 +123,8 @@ DEFAULTS = { 'always_split_with_profile': False, 'title_use_system_font' : True, 'title_font' : 'Sans 9', + 'putty_paste_style' : False, + 'smart_copy' : True, }, 'keybindings': { 'zoom_in' : 'plus', @@ -190,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 f45d092e..27990f19 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() @@ -535,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/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") diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 533e6b62..b95b0450 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 @@ -576,7 +595,7 @@ True False - 6 + 7 2 12 6 @@ -649,6 +668,38 @@ + + + Putty style paste + True + True + False + False + True + + + + 2 + 2 + 3 + + + + + Smart copy + True + True + False + False + True + + + + 2 + 3 + 4 + + Re-use profiles for new terminals @@ -662,8 +713,8 @@ 2 - 2 - 3 + 4 + 5 GTK_FILL @@ -680,8 +731,8 @@ 2 - 3 - 4 + 5 + 6 GTK_FILL @@ -732,27 +783,8 @@ 2 - 4 - 5 - GTK_FILL - - - - - - DBus server - True - True - False - False - True - True - - - - 2 - 5 - 6 + 6 + 7 GTK_FILL diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 09706c27..6b8b7f82 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'), @@ -289,6 +291,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') @@ -707,6 +715,16 @@ 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_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 a96a7979..e4ae8d4b 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 @@ -867,12 +871,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) @@ -890,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) @@ -917,25 +924,32 @@ class Terminal(Gtk.VBox): # Suppress double-click behavior return True - if event.button == 1: + if self.config['putty_paste_style']: + middle_click = [self.popup_menu, (widget, event)] + right_click = [self.paste_clipboard, (True, )] + else: + 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 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 == self.MOUSEBUTTON_MIDDLE: # middleclick should paste the clipboard - self.paste_clipboard(True) + middle_click[0](*middle_click[1]) return(True) - elif event.button == 3: + 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) @@ -1869,6 +1883,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() 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