From 9fa9c0e45a937b2bdd396b39a07be8756baba765 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 28 Nov 2015 19:53:57 +0100 Subject: [PATCH 01/18] Fix deprcation warning in later GTK versions --- terminatorlib/terminator.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index d3426a28..7013f0e5 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -16,8 +16,7 @@ from cwd import get_pid_cwd from version import APP_NAME, APP_VERSION def eventkey2gdkevent(eventkey): # FIXME FOR GTK3: is there a simpler way of casting from specific EventKey to generic (union) GdkEvent? - gdkevent = Gdk.Event(eventkey.type) - gdkevent.key.type = eventkey.type + gdkevent = Gdk.Event.new(eventkey.type) gdkevent.key.window = eventkey.window gdkevent.key.send_event = eventkey.send_event gdkevent.key.time = eventkey.time From 73ba77ee5e1b50106d29ba264834f881e2d8f546 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 28 Nov 2015 20:03:51 +0100 Subject: [PATCH 02/18] Fix separator sizing --- terminatorlib/terminator.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 7013f0e5..ad87f705 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -39,6 +39,7 @@ class Terminator(Borg): groups = None config = None keybindings = None + style_provider = None origcwd = None dbus_path = None @@ -363,14 +364,23 @@ class Terminator(Borg): def reconfigure(self): """Update configuration for the whole application""" + if self.style_provider is not None: + Gtk.StyleContext.remove_provider_for_screen( + Gdk.Screen.get_default(), + self.style_provider) + self.style_provider = None if self.config['handle_size'] in xrange(0, 6): - Gtk.rc_parse_string(""" - style "terminator-paned-style" { - GtkPaned::handle_size = %s + css = """ + GtkPaned { + -GtkPaned-handle-size: %s } - class "GtkPaned" style "terminator-paned-style" - """ % self.config['handle_size']) - Gtk.rc_reset_styles(Gtk.Settings.get_default()) + """ % self.config['handle_size'] + self.style_provider = Gtk.CssProvider() + self.style_provider.load_from_data(css) + Gtk.StyleContext.add_provider_for_screen( + Gdk.Screen.get_default(), + self.style_provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) # Cause all the terminals to reconfigure for terminal in self.terminals: From b5b74e8071dace8902668363b0600d7ff52294b5 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 28 Nov 2015 20:14:14 +0100 Subject: [PATCH 03/18] Add option to toggle the rewrap on resize --- doc/terminator_config.5 | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 16 ++++++++++++++++ terminatorlib/prefseditor.py | 8 ++++++++ terminatorlib/terminal.py | 2 ++ 5 files changed, 31 insertions(+) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 56763c04..c6f736ff 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -465,6 +465,10 @@ Default value: \fBUTF-8\fR .B copy_on_selection \fR(boolean) If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection. Default value: \fBFalse\fR +.TP +.B rewrap_on_resize \fR(boolean) +If True, the terminal contents are rewrapped when the terminal's width changes. Warning: This might be slow if you have a huge scrollback buffer. +Default value: \fBTrue\fR .SH layouts diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 52b34430..501f7f1b 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -240,6 +240,7 @@ DEFAULTS = { 'force_no_bell' : False, 'cycle_term_tab' : True, 'copy_on_selection' : False, + 'rewrap_on_resize' : True, 'split_to_group' : False, 'autoclean_groups' : True, 'http_proxy' : '', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index bfe32de3..d7c63e45 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1603,6 +1603,22 @@ 4 + + + Rewrap on resize + True + True + False + False + True + + + + False + False + 5 + + False diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index cabe27e4..46b02fed 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']) + # Rewrap on resize + widget = guiget('rewrap_on_resize_checkbutton') + widget.set_active(self.config['rewrap_on_resize']) # Cursor shape widget = guiget('cursor_shape_combobox') if self.config['cursor_shape'] == 'underline': @@ -696,6 +699,11 @@ class PrefsEditor: self.config['copy_on_selection'] = widget.get_active() self.config.save() + def on_rewrap_on_resize_toggled(self, widget): + """Rewrap on resize setting changed""" + self.config['rewrap_on_resize'] = 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 a6a7ca44..68a1bf71 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -770,6 +770,8 @@ class Terminal(Gtk.VBox): elif self.config['scrollbar_position'] == 'right': self.reorder_child(self.vte, 0) + self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize']) + self.titlebar.update() self.vte.queue_draw() From 6db2337c56992a4c8cb028d122c89f31d9b54673 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 28 Nov 2015 20:28:01 +0100 Subject: [PATCH 04/18] Add word chars back in if VTE is 0.40+ --- doc/terminator_config.5 | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 41 +++++++++++++++++++++++++++++++++ terminatorlib/prefseditor.py | 11 +++++++++ terminatorlib/terminal.py | 3 +++ 5 files changed, 60 insertions(+) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index c6f736ff..f6cd0089 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -442,6 +442,10 @@ Default value: \fBclose\fR .B palette Terminals have a 16-colour palette that applications inside the terminal can use. This is that palette, in the form of a colon-separated list of colour names. Colour names should be in hex format e.g. "#FF00FF". .TP +.B word_chars +These characters are included when selecting text by double clicking. +Default value: \fB',./?%&#:_'\fR +.TP .B mouse_autohide \fR(boolean) Controls whether the mouse cursor should be hidden while typing. Default value: \fBTrue\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 501f7f1b..063f311d 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -227,6 +227,7 @@ DEFAULTS = { 'palette' : '#2e3436:#cc0000:#4e9a06:#c4a000:\ #3465a4:#75507b:#06989a:#d3d7cf:#555753:#ef2929:#8ae234:#fce94f:\ #729fcf:#ad7fa8:#34e2e2:#eeeeec', + 'word_chars' : ',./?%&#:_', 'mouse_autohide' : True, 'update_records' : True, 'login_shell' : False, diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index d7c63e45..a9ad6853 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1619,6 +1619,47 @@ 5 + + + True + False + 12 + + + True + False + 0 + Select-by-_word characters: + True + center + word_chars_entry + + + False + False + 0 + + + + + True + True + • + + + + True + True + 1 + + + + + False + True + 6 + + False diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 46b02fed..37fa3d58 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -424,6 +424,12 @@ class PrefsEditor: # Rewrap on resize widget = guiget('rewrap_on_resize_checkbutton') widget.set_active(self.config['rewrap_on_resize']) + # Word chars + widget = guiget('word_chars_entry') + widget.set_text(self.config['word_chars']) + # Word char support was missing from vte 0.38, hide from the UI + if not hasattr(self.term.vte, 'set_word_char_exceptions'): + guiget('word_chars_hbox').hide() # Cursor shape widget = guiget('cursor_shape_combobox') if self.config['cursor_shape'] == 'underline': @@ -929,6 +935,11 @@ class PrefsEditor: self.config['cursor_shape'] = value self.config.save() + def on_word_chars_entry_changed(self, widget): + """Word characters changed""" + self.config['word_chars'] = widget.get_text() + self.config.save() + def on_font_selector_font_set(self, widget): """Font changed""" self.config['font'] = widget.get_font_name() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 68a1bf71..4f28872c 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -628,6 +628,9 @@ class Terminal(Gtk.VBox): if self.custom_encoding != True: self.vte.set_encoding(self.config['encoding']) + # Word char support was missing from vte 0.38, silently skip this setting + if hasattr(self.vte, 'set_word_char_exceptions'): + self.vte.set_word_char_exceptions(self.config['word_chars']) self.vte.set_mouse_autohide(self.config['mouse_autohide']) backspace = self.config['backspace_binding'] From c1f92495d89a7f8282242082539e68a255ca01f3 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 00:01:55 +0100 Subject: [PATCH 05/18] Fix positioning of group popup menu for later versions of GTK --- terminatorlib/terminal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 4f28872c..abc72f5b 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -549,8 +549,10 @@ class Terminal(Gtk.VBox): return(menu) - def position_popup_group_menu(self, menu, widget): + def position_popup_group_menu(self, menu, *args): """Calculate the position of the group popup menu""" + # GTK API, or GIR just changed the args. See LP#1518058 + widget = args[-1] _screen_w = Gdk.Screen.width() screen_h = Gdk.Screen.height() From 910396190281c5b0a98c4df7c21212b5afc4b58e Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 00:22:57 +0100 Subject: [PATCH 06/18] Make Zoom/Maximize inactive if a single terminal --- terminatorlib/terminal_popup_menu.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index 322f6be2..e9cd1b5d 100755 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -151,12 +151,16 @@ class TerminalPopupMenu(object): menu.append(Gtk.MenuItem()) if not terminal.is_zoomed(): + sensitive = not terminal.get_toplevel() == terminal.get_parent() + item = Gtk.MenuItem.new_with_mnemonic(_('_Zoom terminal')) item.connect('activate', terminal.zoom) + item.set_sensitive(sensitive) menu.append(item) item = Gtk.MenuItem.new_with_mnemonic(_('Ma_ximise terminal')) item.connect('activate', terminal.maximise) + item.set_sensitive(sensitive) menu.append(item) menu.append(Gtk.MenuItem()) From fbb70b2bc68e540e7168b5fba2586cd27741598d Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 00:39:22 +0100 Subject: [PATCH 07/18] Correct some British spelt translated strings to American~ --- terminatorlib/optionparse.py | 2 +- terminatorlib/preferences.glade | 2 +- terminatorlib/prefseditor.py | 2 +- terminatorlib/terminal_popup_menu.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index 1c36ad21..f22e4207 100755 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -49,7 +49,7 @@ def parse_options(): parser.add_option('-v', '--version', action='store_true', dest='version', help=_('Display program version')) parser.add_option('-m', '--maximise', action='store_true', dest='maximise', - help=_('Maximise the window')) + help=_('Maximize the window')) parser.add_option('-f', '--fullscreen', action='store_true', dest='fullscreen', help=_('Make the window fill the screen')) parser.add_option('-b', '--borderless', action='store_true', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index a9ad6853..9d04d2d2 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -69,7 +69,7 @@ Black on white - Grey on black + Gray on black Green on black diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 37fa3d58..0924e005 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -115,7 +115,7 @@ class PrefsEditor: 'resize_right' : _('Resize the terminal right'), 'move_tab_right' : _('Move the tab right'), 'move_tab_left' : _('Move the tab left'), - 'toggle_zoom' : _('Maximise terminal'), + 'toggle_zoom' : _('Maximize terminal'), 'scaled_zoom' : _('Zoom terminal'), 'next_tab' : _('Switch to the next tab'), 'prev_tab' : _('Switch to the previous tab'), diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index e9cd1b5d..b672e083 100755 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -158,7 +158,7 @@ class TerminalPopupMenu(object): item.set_sensitive(sensitive) menu.append(item) - item = Gtk.MenuItem.new_with_mnemonic(_('Ma_ximise terminal')) + item = Gtk.MenuItem.new_with_mnemonic(_('Ma_ximize terminal')) item.connect('activate', terminal.maximise) item.set_sensitive(sensitive) menu.append(item) From 47642be133c32d95184b172e48ad559e65cd23e0 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 01:35:05 +0100 Subject: [PATCH 08/18] Fix double double-click on titlebar in later GTK3 --- terminatorlib/editablelabel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/editablelabel.py b/terminatorlib/editablelabel.py index a073be21..9e05714b 100644 --- a/terminatorlib/editablelabel.py +++ b/terminatorlib/editablelabel.py @@ -73,6 +73,8 @@ class EditableLabel(Gtk.EventBox): 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 ()) From 918b53c6f01840c82ce89cb4abfcbf893265608e Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 02:51:26 +0100 Subject: [PATCH 09/18] Fix the palette for inactive terminals after Prefs window --- terminatorlib/terminal.py | 8 ++++++-- terminatorlib/terminator.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index abc72f5b..3251d04a 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -731,8 +731,12 @@ class Terminal(Gtk.VBox): getattr(newcolor_inactive, bit) * factor) self.palette_active.append(newcolor) self.palette_inactive.append(newcolor_inactive) - self.vte.set_colors(self.fgcolor_active, self.bgcolor, - self.palette_active) + if self.terminator.last_focused_term == self: + self.vte.set_colors(self.fgcolor_active, self.bgcolor, + self.palette_active) + else: + self.vte.set_colors(self.fgcolor_inactive, self.bgcolor, + self.palette_inactive) self.set_cursor_color() self.vte.set_cursor_shape(getattr(Vte.CursorShape, self.config['cursor_shape'].upper())); diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index ad87f705..47410be3 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -40,6 +40,7 @@ class Terminator(Borg): config = None keybindings = None style_provider = None + last_focused_term = None origcwd = None dbus_path = None From ecd3cb6b63a650a5d9609f2f6ac1f7ab150096b6 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 03:07:13 +0100 Subject: [PATCH 10/18] Fix copy on selection to work on already open terminals --- terminatorlib/terminal.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 3251d04a..4ea73db7 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -352,6 +352,10 @@ class Terminal(Gtk.VBox): self.vte.match_remove(self.matches[name]) del(self.matches[name]) + def maybe_copy_clipboard(self): + if self.config['copy_on_selection']: + self.vte.copy_clipboard() + def connect_signals(self): """Connect all the gtk signals and drag-n-drop mechanics""" @@ -410,10 +414,8 @@ class Terminal(Gtk.VBox): self.vte.connect('drag-data-received', self.on_drag_data_received, self) - # FIXME: Shouldn't this be in configure()? - if self.config['copy_on_selection']: - self.cnxids.new(self.vte, 'selection-changed', - lambda widget: self.vte.copy_clipboard()) + self.cnxids.new(self.vte, 'selection-changed', + lambda widget: self.maybe_copy_clipboard()) if self.composite_support: self.vte.connect('composited-changed', self.reconfigure) From 80b157ee339f7e65b53c7c5f1d6321878135daee Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 05:27:59 +0100 Subject: [PATCH 11/18] Add dimming for 256 colour palettes --- terminatorlib/terminal.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 4ea73db7..75bd7fb2 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -722,17 +722,35 @@ class Terminal(Gtk.VBox): getattr(self.fgcolor_inactive, "blue"))) colors = self.config['palette'].split(':') self.palette_active = [] - self.palette_inactive = [] for color in colors: if color: newcolor = Gdk.RGBA() newcolor.parse(color) - newcolor_inactive = newcolor.copy() - for bit in ['red', 'green', 'blue']: - setattr(newcolor_inactive, bit, - getattr(newcolor_inactive, bit) * factor) self.palette_active.append(newcolor) - self.palette_inactive.append(newcolor_inactive) + if len(colors) == 16: + # RGB values for indices 16..255 copied from vte source in order to dim them + shades = [0, 95, 135, 175, 215, 255] + for r in xrange(0, 6): + for g in xrange(0, 6): + for b in xrange(0, 6): + newcolor = Gdk.RGBA() + setattr(newcolor, "red", shades[r] / 255.0) + setattr(newcolor, "green", shades[g] / 255.0) + setattr(newcolor, "blue", shades[b] / 255.0) + self.palette_active.append(newcolor) + for y in xrange(8, 248, 10): + newcolor = Gdk.RGBA() + setattr(newcolor, "red", y / 255.0) + setattr(newcolor, "green", y / 255.0) + setattr(newcolor, "blue", y / 255.0) + self.palette_active.append(newcolor) + self.palette_inactive = [] + for color in self.palette_active: + newcolor = Gdk.RGBA() + for bit in ['red', 'green', 'blue']: + setattr(newcolor, bit, + getattr(color, bit) * factor) + self.palette_inactive.append(newcolor) if self.terminator.last_focused_term == self: self.vte.set_colors(self.fgcolor_active, self.bgcolor, self.palette_active) From 7f071e0d7e3004092a0ff085f46d09f49eb027ba Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 19:33:52 +0100 Subject: [PATCH 12/18] Fix unwanted seperator size change, and increase granularity of dim/transparent sliders --- terminatorlib/preferences.glade | 7 +++++-- terminatorlib/prefseditor.py | 17 +++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 9d04d2d2..8159eabb 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -861,10 +861,12 @@ + 100 True True adjustment7 - 1 + 2 + 2 left @@ -2839,7 +2841,8 @@ True True background_darkness_scale - 1 + 2 + 2 bottom diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 0924e005..02de5775 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -826,9 +826,12 @@ class PrefsEditor: self.config['scrollbar_position'] = value self.config.save() - def on_darken_background_scale_change_value(self, widget, scroll, value): + def on_darken_background_scale_change_value(self, widget, scroll, _value_not_rounded): """Background darkness setting changed""" - self.config['background_darkness'] = round(value, 2) + value = widget.get_value() # This one is rounded according to the UI. + if value > 1.0: + value = 1.0 + self.config['background_darkness'] = value self.config.save() def on_palette_combobox_changed(self, widget): @@ -980,16 +983,18 @@ class PrefsEditor: self.config['title_transmit_fg_color'] = color2hex(widget) self.config.save() - def on_inactive_color_offset_change_value(self, widget, scroll, value): + def on_inactive_color_offset_change_value(self, widget, scroll, _value_not_rounded): """Inactive color offset setting changed""" + value = widget.get_value() # This one is rounded according to the UI. if value > 1.0: value = 1.0 - self.config['inactive_color_offset'] = round(value, 2) + self.config['inactive_color_offset'] = value self.config.save() - def on_handlesize_change_value(self, widget, scroll, value): + def on_handlesize_change_value(self, widget, scroll, _value_not_rounded): """Handle size changed""" - value = int(value) + value = widget.get_value() # This one is rounded according to the UI. + value = int(value) # Cast to int. if value > 5: value = 5 self.config['handle_size'] = value From 9bd8b5ea09ec9a1e4f5876ccec60cce45a16ba1e Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 20:19:11 +0100 Subject: [PATCH 13/18] Fix cwd when new term spawned from a symlinked directory --- terminatorlib/terminal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 75bd7fb2..3b5159fc 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1394,6 +1394,7 @@ class Terminal(Gtk.VBox): envv = [] envv.append('TERM=%s' % self.config['term']) envv.append('COLORTERM=%s' % self.config['colorterm']) + envv.append('PWD=%s' % self.cwd) envv.append('TERMINATOR_UUID=%s' % self.uuid.urn) if self.terminator.dbus_name: envv.append('TERMINATOR_DBUS_NAME=%s' % self.terminator.dbus_name) From a8362749a917eabe6913250906ec1e7e5a4f30c3 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 21:11:42 +0100 Subject: [PATCH 14/18] Update TERM/COLORTERM to more modern values --- doc/terminator_config.5 | 6 +++--- terminatorlib/config.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index f6cd0089..13680233 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -382,13 +382,13 @@ Default value: Current value of \fBforeground_color\fR Default shape of cursor. Possibilities are "block", "ibeam", and "underline". Default value: \fBblock\fR .TP -.B xterm +.B term This translates into the value that will be set for TERM in the environment of your terminals. -Default value: \fBxterm\fR +Default value: \fBxterm-256color\fR .TP .B colorterm This translates into the value that will be set for COLORTERM in the environment of your terminals. -Default value: \fBgnome-terminal\fR +Default value: \fBtruecolor\fR .TP .B use_system_font Whether or not to use the GNOME default monospace font for terminals. diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 063f311d..7fbec4e8 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -212,8 +212,8 @@ DEFAULTS = { 'cursor_blink' : True, 'cursor_shape' : 'block', 'cursor_color' : '#aaaaaa', - 'term' : 'xterm', - 'colorterm' : 'gnome-terminal', + 'term' : 'xterm-256color', + 'colorterm' : 'truecolor', 'font' : 'Mono 10', 'foreground_color' : '#aaaaaa', 'show_titlebar' : True, From 4d70db1ae2d37def928cff4b840c06f2c2a82e8d Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 23:22:11 +0100 Subject: [PATCH 15/18] Correct terminator_config man page regarding scrollback --- doc/terminator_config.5 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 13680233..f4fbc015 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -423,11 +423,11 @@ If true, whenever there's new output the terminal will scroll to the bottom. Default value: \fBTrue\fR .TP .B scrollback_lines -Number of scrollback lines to keep around. You can scroll back in the terminal by this number of lines; lines that don't fit in the scrollback are discarded. Be careful with this setting; it's the primary factor in determining how much memory the terminal will use. +Number of scrollback lines to keep around. You can scroll back in the terminal by this number of lines; lines that don't fit in the scrollback are discarded. Warning: with large values, rewrapping on resize might be slow. Default value: \fB500\fR .TP .B scrollback_infinite -If this is set to True, scrollback_lines will be ignored and VTE will continue to allocate RAM for scrollback history. +If this is set to True, scrollback_lines will be ignored and VTE will keep the entire scrollback history. Default value: \fBFalse\fR .TP .B focus_on_close @@ -495,4 +495,5 @@ Window objects may not have a parent attribute. \fBEvery\fR other object must sp Terminator plugins can add their own configuration to the config file, and will appear as a sub-section. Please refer to the documentation of individual plugins for more information. .SH "SEE ALSO" -.BR gnome\-terminal(1), http://www.voidspace.org.uk/python/configobj.html +.TP +\fBterminator\fP(1), http://www.voidspace.org.uk/python/configobj.html From 14fb184df8276b72339446153b8e1bdfef7cf01a Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 23:37:02 +0100 Subject: [PATCH 16/18] Fix exception when Ctrl-clicking the terminal when not over a URL --- terminatorlib/terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 3b5159fc..427a2739 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -921,7 +921,7 @@ class Terminal(Gtk.VBox): # Ctrl+leftclick on a URL should open it if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK: url = self.check_for_url(event) - if url: + if url[0]: self.open_url(url, prepare=True) elif event.button == 2: # middleclick should paste the clipboard From b85796d64b9418fc855f7a2e427cebcd3121e6a0 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 23:43:45 +0100 Subject: [PATCH 17/18] Fix Ctrl-click on URL if terminal has padding --- terminatorlib/terminal.py | 7 +------ terminatorlib/terminal_popup_menu.py | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 427a2739..3a2b912f 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -920,7 +920,7 @@ class Terminal(Gtk.VBox): if event.button == 1: # Ctrl+leftclick on a URL should open it if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK: - url = self.check_for_url(event) + url = self.vte.match_check_event(event) if url[0]: self.open_url(url, prepare=True) elif event.button == 2: @@ -1418,11 +1418,6 @@ class Terminal(Gtk.VBox): self.vte.feed(_('Unable to start shell:') + shell) return(-1) - def check_for_url(self, event): - """Check if the mouse is over a URL""" - return (self.vte.match_check(int(event.x / self.vte.get_char_width()), - int(event.y / self.vte.get_char_height()))) - def prepare_url(self, urlmatch): """Prepare a URL from a VTE match""" url = urlmatch[0] diff --git a/terminatorlib/terminal_popup_menu.py b/terminatorlib/terminal_popup_menu.py index b672e083..4b7d91cd 100755 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -40,7 +40,7 @@ class TerminalPopupMenu(object): self.config.set_profile(terminal.get_profile()) if event: - url = terminal.check_for_url(event) + url = terminal.vte.match_check_event(event) button = event.button time = event.time else: From df0d9aa0eba4eb318a5dcaf3d7e5317a0dc8385d Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 23:57:13 +0100 Subject: [PATCH 18/18] Fix right-click for mouse aware apps --- terminatorlib/terminal.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 3a2b912f..71696e49 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -928,9 +928,14 @@ class Terminal(Gtk.VBox): self.paste_clipboard(True) return(True) elif event.button == 3: - # rightclick should display a context menu if Ctrl is not pressed + # 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: - self.popup_menu(widget, event) + 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) + else: + self.popup_menu(widget, event) return(True) return(False)