From 1d7ca2f81a3729167ad0be57d8e996d5accc6891 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 00:22:55 +0100 Subject: [PATCH 01/10] 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 887badc6..ad67f3b9 100755 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -150,12 +150,16 @@ class TerminalPopupMenu(object): menu.append(gtk.MenuItem()) if not terminal.is_zoomed(): + sensitive = not terminal.get_toplevel() == terminal.get_parent() + item = gtk.MenuItem(_('_Zoom terminal')) item.connect('activate', terminal.zoom) + item.set_sensitive(sensitive) menu.append(item) item = gtk.MenuItem(_('Ma_ximise terminal')) item.connect('activate', terminal.maximise) + item.set_sensitive(sensitive) menu.append(item) menu.append(gtk.MenuItem()) From e782204f9f08ccdc01cdc8b5abaced34b712bc59 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 00:39:30 +0100 Subject: [PATCH 02/10] 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 4bc577a8..4b0690b8 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 3f791e72..f2f25805 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -116,7 +116,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 ad67f3b9..f4b8edcf 100755 --- a/terminatorlib/terminal_popup_menu.py +++ b/terminatorlib/terminal_popup_menu.py @@ -157,7 +157,7 @@ class TerminalPopupMenu(object): item.set_sensitive(sensitive) menu.append(item) - item = gtk.MenuItem(_('Ma_ximise terminal')) + item = gtk.MenuItem(_('Ma_ximize terminal')) item.connect('activate', terminal.maximise) item.set_sensitive(sensitive) menu.append(item) From edee76f78ef91749907d6eaac04f78bee31e61a9 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 02:51:29 +0100 Subject: [PATCH 03/10] 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 4f6af869..0ee7c21b 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -677,8 +677,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() if hasattr(self.vte, 'set_cursor_shape'): self.vte.set_cursor_shape(getattr(vte, 'CURSOR_SHAPE_' + diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 5508d406..525748f4 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -25,6 +25,7 @@ class Terminator(Borg): groups = None config = None keybindings = None + last_focused_term = None origcwd = None dbus_path = None From 4d8b6acad2bd859a8e0eec51154ce5e51ab984fa Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 03:07:07 +0100 Subject: [PATCH 04/10] 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 0ee7c21b..f37973e2 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -339,6 +339,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""" @@ -375,10 +379,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 5c96bb4aaa688b577d37b6c2c7ec163ffe031b6e Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 05:25:03 +0100 Subject: [PATCH 05/10] Fix warning trying to import the __init__.py file as a plugin --- terminatorlib/plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/plugin.py b/terminatorlib/plugin.py index 639b6542..33f69623 100755 --- a/terminatorlib/plugin.py +++ b/terminatorlib/plugin.py @@ -86,6 +86,8 @@ class PluginRegistry(borg.Borg): sys.path.remove(plugindir) continue for plugin in files: + if plugin == '__init__.py': + continue pluginpath = os.path.join(plugindir, plugin) if os.path.isfile(pluginpath) and plugin[-3:] == '.py': dbg('PluginRegistry::load_plugins: Importing plugin %s' % From a4af9a1b3dc792edf6f1a92032a33ee799dfdd27 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 05:27:56 +0100 Subject: [PATCH 06/10] Add dimming for 256 colour palettes --- terminatorlib/terminal.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index f37973e2..9e11410f 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -669,16 +669,33 @@ 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 = gtk.gdk.color_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 = gtk.gdk.Color(shades[r] / 255.0, + shades[g] / 255.0, + shades[b] / 255.0) + self.palette_active.append(newcolor) + for y in xrange(8, 248, 10): + newcolor = gtk.gdk.Color(y / 255.0, + y / 255.0, + y / 255.0) + self.palette_active.append(newcolor) + self.palette_active = self.palette_active[:255] + self.palette_inactive = [] + for color in self.palette_active: + newcolor = gtk.gdk.Color() + 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 0b8fd51d5e552cc4bb60f60954a0d046d7310034 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 19:33:57 +0100 Subject: [PATCH 07/10] 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 4b0690b8..b2e37651 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -864,10 +864,12 @@ + 100 True True adjustment7 - 1 + 2 + 2 left @@ -2955,7 +2957,8 @@ True True background_darkness_scale - 1 + 2 + 2 bottom diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index f2f25805..3b353092 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -861,9 +861,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_background_image_filechooser_file_set(self, widget): @@ -1020,16 +1023,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 b51fe1d2503b6e38c47457b9f9665b02e5a694f6 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 20:19:09 +0100 Subject: [PATCH 08/10] Fix cwd when new term spawned from a symlinked directory - has no impact, just keeping code aligned --- terminatorlib/terminal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 9e11410f..d9711d52 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1407,6 +1407,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 d9e1b32e6911cfbcee1cc6ce57ea0eca67e4b359 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 23:22:14 +0100 Subject: [PATCH 09/10] 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 411238a9..7f3c4fe3 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -463,11 +463,11 @@ Whether or not the mouse wheel scrolls alternate screen buffers (man, vim, mutt, 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. 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 @@ -531,4 +531,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 365cf7769324725fc2936e110cebf4cd772dbb17 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 29 Nov 2015 23:25:31 +0100 Subject: [PATCH 10/10] Update TERM to more modern values --- doc/terminator_config.5 | 4 ++-- terminatorlib/config.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 7f3c4fe3..a1fca6eb 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -418,9 +418,9 @@ Default value: \fBblock\fR Sets what type of terminal should be emulated. Default value: \fBxterm\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. diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 797bb94c..47355d86 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -217,7 +217,7 @@ DEFAULTS = { 'cursor_shape' : 'block', 'cursor_color' : '#aaaaaa', 'emulation' : 'xterm', - 'term' : 'xterm', + 'term' : 'xterm-256color', 'colorterm' : 'gnome-terminal', 'font' : 'Mono 10', 'foreground_color' : '#aaaaaa',