From 6d6d73568debe54f2c88d289ebf45afbbede1370 Mon Sep 17 00:00:00 2001 From: Przemek Wesolek Date: Sat, 5 Nov 2011 16:49:01 +0100 Subject: [PATCH 01/29] New terminal inherits the current one's profile. --- terminatorlib/notebook.py | 4 +++- terminatorlib/paned.py | 2 ++ terminatorlib/window.py | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index bef0caf9..da8b2fd2 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -195,7 +195,7 @@ class Notebook(Container, gtk.Notebook): children.append(self.get_nth_page(page)) return(children) - def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None): + def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None, profile=None): """Add a new tab, optionally supplying a child widget""" dbg('making a new tab') maker = Factory() @@ -256,6 +256,8 @@ class Notebook(Container, gtk.Notebook): self.show_all() if maker.isinstance(widget, 'Terminal'): widget.grab_focus() + if profile: + widget.force_set_profile(None, profile) def wrapcloseterm(self, widget): """A child terminal has closed""" diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 2349a529..44abe25b 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -60,6 +60,8 @@ class Paned(Container): sibling = self.maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if sibling: + sibling.force_set_profile(None, widget.get_profile()) self.add(container) self.show_all() diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8fb4fbf7..da1b2544 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -219,6 +219,7 @@ class Window(Container, gtk.Window): def tab_new(self, widget=None, debugtab=False, _param1=None, _param2=None): """Make a new tab""" cwd = None + profile = None if self.get_property('term_zoomed') == True: err("You can't create a tab while a terminal is maximised/zoomed") @@ -226,11 +227,13 @@ class Window(Container, gtk.Window): if widget: cwd = widget.get_cwd() + profile = widget.get_profile() + maker = Factory() if not self.is_child_notebook(): dbg('Making a new Notebook') notebook = maker.make('Notebook', window=self) - self.get_child().newtab(debugtab, cwd=cwd) + self.get_child().newtab(debugtab, cwd=cwd, profile=profile) def on_delete_event(self, window, event, data=None): """Handle a window close request""" @@ -425,6 +428,9 @@ class Window(Container, gtk.Window): sibling = maker.make('Terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if sibling: + sibling.force_set_profile(None, widget.get_profile()) + self.add(container) container.show_all() From f5cd4b053d9936bed1f44c19d451367fa609d6a9 Mon Sep 17 00:00:00 2001 From: Przemek Wesolek Date: Sat, 5 Nov 2011 16:58:39 +0100 Subject: [PATCH 02/29] Inheriting profile on a split in tabbed pane. --- terminatorlib/notebook.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index da8b2fd2..1d0ae76f 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -136,6 +136,8 @@ class Notebook(Container, gtk.Notebook): sibling = maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if sibling: + sibling.force_set_profile(None, widget.get_profile()) self.insert_page(container, None, page_num) self.set_tab_reorderable(container, True) From cef607817d12d9a64cda62f680c23cce2fa1cd89 Mon Sep 17 00:00:00 2001 From: Przemek Wesolek Date: Wed, 16 Nov 2011 21:38:24 +0100 Subject: [PATCH 03/29] Moved profile setting on new tab a bit earlier, before show_all() call. --- terminatorlib/notebook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 1d0ae76f..9c9b20d6 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -208,6 +208,8 @@ class Notebook(Container, gtk.Notebook): if cwd: widget.set_cwd(cwd) widget.spawn_child(debugserver=debugtab) + if profile: + widget.force_set_profile(None, profile) signals = {'close-term': self.wrapcloseterm, 'split-horiz': self.split_horiz, @@ -258,8 +260,6 @@ class Notebook(Container, gtk.Notebook): self.show_all() if maker.isinstance(widget, 'Terminal'): widget.grab_focus() - if profile: - widget.force_set_profile(None, profile) def wrapcloseterm(self, widget): """A child terminal has closed""" From d76b0dee7f25a39e656f389ac4ea473c926e3f6f Mon Sep 17 00:00:00 2001 From: Date: Thu, 29 Dec 2011 20:02:11 +0100 Subject: [PATCH 04/29] Added a parameter to the dbus method new_window, to allow the passing of the command to execute. --- terminator | 2 +- terminatorlib/ipc.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/terminator b/terminator index 1fd95ccd..7c4b978c 100755 --- a/terminator +++ b/terminator @@ -66,7 +66,7 @@ if __name__ == '__main__': dbus_service = ipc.DBusService() except ipc.DBusException: dbg('Unable to become master process, requesting a new window') - ipc.new_window(OPTIONS.layout) + ipc.new_window(OPTIONS.layout, OPTIONS.command or '') sys.exit() except ImportError: dbg('dbus not imported') diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index d413be84..dbcbaaef 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -59,11 +59,16 @@ class DBusService(Borg, dbus.service.Object): self.terminator = Terminator() @dbus.service.method(BUS_NAME) - def new_window(self, layout='default'): + def new_window(self, layout, command=''): """Create a new Window""" - dbg('dbus method called: new_window') + dbg('dbus method called: new_window with parameters %s, %s'%(layout, command)) + if command: + options = self.terminator.config.options_get() + options.command = command + self.terminator.config.options_set(options) self.terminator.create_layout(layout) self.terminator.layout_done() + @dbus.service.method(BUS_NAME) def terminal_hsplit(self, uuid=None): @@ -103,9 +108,9 @@ def with_proxy(func): return _exec @with_proxy -def new_window(session, layout='default'): +def new_window(session, layout='default', command=''): """Call the dbus method to open a new window""" - session.new_window(layout) + session.new_window(layout, command) @with_proxy def terminal_hsplit(session, uuid): From abdcc0f201f9181531c645e907496dc955fc571d Mon Sep 17 00:00:00 2001 From: Date: Thu, 29 Dec 2011 21:39:09 +0100 Subject: [PATCH 05/29] Changed the dbus method new_window to use an array of options instead of only passing the layout, also formatted a little the help strings in the optionparse module (to fit in 80 chars without breaking the indent) --- terminator | 14 +++++++++++++- terminatorlib/ipc.py | 19 +++++++++---------- terminatorlib/optionparse.py | 31 +++++++++++++++++-------------- terminatorlib/window.py | 6 +++--- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/terminator b/terminator index 7c4b978c..575bc604 100755 --- a/terminator +++ b/terminator @@ -62,11 +62,23 @@ if __name__ == '__main__': dbg('dbus disabled by command line') raise ImportError from terminatorlib import ipc + import dbus try: dbus_service = ipc.DBusService() except ipc.DBusException: dbg('Unable to become master process, requesting a new window') - ipc.new_window(OPTIONS.layout, OPTIONS.command or '') + # get rid of the None and True types so dbus can handle them (empty + # and 'True' strings are used instead), also arrays are joined + # (the -x argument for example) + optionslist = {} + for opt, val in OPTIONS.__dict__.items(): + if type(val) == type([]): + val = ' '.join(val) + if val == True: + val = 'True' + optionslist[opt] = val or '' + optionslist = dbus.Dictionary(optionslist, signature='ss') + ipc.new_window(optionslist) sys.exit() except ImportError: dbg('dbus not imported') diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index dbcbaaef..b791a40b 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -58,15 +58,14 @@ class DBusService(Borg, dbus.service.Object): if not self.terminator: self.terminator = Terminator() - @dbus.service.method(BUS_NAME) - def new_window(self, layout, command=''): + @dbus.service.method(BUS_NAME, in_signature='a{ss}') + def new_window(self, options=dbus.Dictionary()): """Create a new Window""" - dbg('dbus method called: new_window with parameters %s, %s'%(layout, command)) - if command: - options = self.terminator.config.options_get() - options.command = command - self.terminator.config.options_set(options) - self.terminator.create_layout(layout) + dbg('dbus method called: new_window with parameters %s'%(options)) + oldopts = self.terminator.config.options_get() + oldopts.__dict__ = options + self.terminator.config.options_set(oldopts) + self.terminator.create_layout(oldopts.layout) self.terminator.layout_done() @@ -108,9 +107,9 @@ def with_proxy(func): return _exec @with_proxy -def new_window(session, layout='default', command=''): +def new_window(session, options): """Call the dbus method to open a new window""" - session.new_window(layout, command) + session.new_window(options) @with_proxy def terminal_hsplit(session, uuid): diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index 13a2a09d..70a29165 100755 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -53,22 +53,25 @@ def parse_options(): dest='borderless', help=_('Disable window borders')) parser.add_option('-H', '--hidden', action='store_true', dest='hidden', help=_('Hide the window at startup')) - parser.add_option('-T', '--title', dest='forcedtitle', help=_('Specify a \ -title for the window')) - parser.add_option('--geometry', dest='geometry', type='string', help=_('Set \ -the preferred size and position of the window (see X man page)')) - parser.add_option('-e', '--command', dest='command', help=_('Specify a \ -command to execute inside the terminal')) + parser.add_option('-T', '--title', dest='forcedtitle', + help=_('Specify a title for the window')) + parser.add_option('--geometry', dest='geometry', type='string', + help=_('Set the preferred size and position of the window' + '(see X man page)')) + parser.add_option('-e', '--command', dest='command', + help=_('Specify a command to execute inside the terminal')) parser.add_option('-x', '--execute', dest='execute', action='callback', - callback=execute_cb, help=_('Use the rest of the command line as a \ -command to execute inside the terminal, and its arguments')) + callback=execute_cb, + help=_('Use the rest of the command line as a command to execute' + 'nside the terminal, and its arguments')) parser.add_option('--working-directory', metavar='DIR', dest='working_directory', help=_('Set the working directory')) - parser.add_option('-r', '--role', dest='role', help=_('Set a custom \ -WM_WINDOW_ROLE property on the window')) - parser.add_option('-l', '--layout', dest='layout', help=_('Select a layout')) - parser.add_option('-p', '--profile', dest='profile', help=_('Use a \ -different profile as the default')) + parser.add_option('-r', '--role', dest='role', + help=_('Set a custom WM_WINDOW_ROLE property on the window')) + parser.add_option('-l', '--layout', dest='layout', + help=_('Select a layout')) + parser.add_option('-p', '--profile', dest='profile', + help=_('Use a different profile as the default')) parser.add_option('-u', '--no-dbus', action='store_true', dest='nodbus', help=_('Disable DBus')) parser.add_option('-d', '--debug', action='count', dest='debug', @@ -78,7 +81,7 @@ different profile as the default')) parser.add_option('--debug-methods', action='store', dest='debug_methods', help=_('Comma separated list of methods to limit debugging to')) for item in ['--sm-client-id', '--sm-config-prefix', '--screen', '-n', - '--no-gconf' ]: + '--no-gconf' ]: parser.add_option(item, dest='dummy', action='store', help=SUPPRESS_HELP) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8fb4fbf7..1921bb7a 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -70,13 +70,13 @@ class Window(Container, gtk.Window): options = self.config.options_get() if options: - if options.forcedtitle is not None: + if options.forcedtitle: self.title.force_title(options.forcedtitle) - if options.role is not None: + if options.role: self.set_role(options.role) - if options.geometry is not None: + if options.geometry: if not self.parse_geometry(options.geometry): err('Window::__init__: Unable to parse geometry: %s' % options.geometry) From f12f7e7b47218dd2e51fba89c235a7f09fb154a0 Mon Sep 17 00:00:00 2001 From: Date: Thu, 29 Dec 2011 21:43:12 +0100 Subject: [PATCH 06/29] Added a little transformatios to make sure all the parameters of the config are passed to string before calling the dbus method (integers for example). --- terminator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminator b/terminator index 575bc604..f0f8a41a 100755 --- a/terminator +++ b/terminator @@ -76,7 +76,7 @@ if __name__ == '__main__': val = ' '.join(val) if val == True: val = 'True' - optionslist[opt] = val or '' + optionslist[opt] = val and '%s'%val or '' optionslist = dbus.Dictionary(optionslist, signature='ss') ipc.new_window(optionslist) sys.exit() From 6f4cc90d523907b5c987f5cc8dead0900571c57b Mon Sep 17 00:00:00 2001 From: pas Date: Fri, 30 Mar 2012 23:35:19 +0400 Subject: [PATCH 07/29] Add commandline option for specifying config file --- terminatorlib/config.py | 9 +++++++-- terminatorlib/optionparse.py | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index fc9ed558..eeb61bd8 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -421,6 +421,8 @@ class ConfigBase(Borg): Borg.__init__(self, self.__class__.__name__) self.prepare_attributes() + import optionparse + self.command_line_options = optionparse.options self.load() def prepare_attributes(self): @@ -520,7 +522,10 @@ class ConfigBase(Borg): dbg('ConfigBase::load: config already loaded') return - filename = os.path.join(get_config_dir(), 'config') + if not self.command_line_options.config: + self.command_line_options.config = os.path.join(get_config_dir(), 'config') + filename = self.command_line_options.config + dbg('looking for config file: %s' % filename) try: configfile = open(filename, 'r') @@ -616,7 +621,7 @@ class ConfigBase(Borg): if not os.path.isdir(config_dir): os.makedirs(config_dir) try: - parser.write(open(os.path.join(config_dir, 'config'), 'w')) + parser.write(open(self.command_line_options.config, 'w')) except Exception, ex: err('ConfigBase::save: Unable to save config: %s' % ex) diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index 13a2a09d..a7c0e5e6 100755 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -26,6 +26,8 @@ import config import version from translation import _ +options = None + def execute_cb(option, opt, value, lparser): """Callback for use in parsing execute options""" assert value is None @@ -40,7 +42,6 @@ def parse_options(): """Parse the command line options""" usage = "usage: %prog [options]" - configobj = config.Config() parser = OptionParser(usage) parser.add_option('-v', '--version', action='store_true', dest='version', @@ -55,6 +56,8 @@ def parse_options(): help=_('Hide the window at startup')) parser.add_option('-T', '--title', dest='forcedtitle', help=_('Specify a \ title for the window')) + parser.add_option('-c', '--config', dest='config', help=_('Specify a \ +config file')) parser.add_option('--geometry', dest='geometry', type='string', help=_('Set \ the preferred size and position of the window (see X man page)')) parser.add_option('-e', '--command', dest='command', help=_('Specify a \ @@ -82,6 +85,7 @@ different profile as the default')) parser.add_option(item, dest='dummy', action='store', help=SUPPRESS_HELP) + global options (options, args) = parser.parse_args() if len(args) != 0: parser.error('Additional unexpected arguments found: %s' % args) @@ -118,6 +122,7 @@ different profile as the default')) if options.layout is None: options.layout = 'default' + configobj = config.Config() if options.profile and options.profile not in configobj.list_profiles(): options.profile = None From 9b15e3033efc8651c4b0a35f1a19bf1da70ee422 Mon Sep 17 00:00:00 2001 From: pas Date: Sat, 31 Mar 2012 01:02:57 +0400 Subject: [PATCH 08/29] Focus window after showing it via hotkey the same way Guake does it --- terminatorlib/window.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8fb4fbf7..36b0bb6d 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -273,6 +273,12 @@ class Window(Container, gtk.Window): if self.position: self.move(self.position[0], self.position[1]) self.show() + self.grab_focus() + try: + t = gtk.gdk.x11_get_server_time(self.window) + except AttributeError: + t = 0 + self.window.focus(t) else: self.position = self.get_position() self.hidefunc() From 3951acedf6a576e6938b574e1ee5032466abf438 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 24 Jun 2012 20:22:21 +0200 Subject: [PATCH 09/29] Hide the group label while editing the group --- terminatorlib/titlebar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index 7f2e23fb..91e4b2bc 100755 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -234,6 +234,7 @@ class Titlebar(gtk.EventBox): def create_group(self): """Create a new group""" self.groupentry.show() + self.grouplabel.hide() self.groupentry.grab_focus() self.update_visibility() @@ -241,6 +242,7 @@ class Titlebar(gtk.EventBox): """Hide the group name entry""" self.groupentry.set_text('') self.groupentry.hide() + self.grouplabel.show() self.get_parent().grab_focus() def groupentry_activate(self, widget): From 11eb98f2e3fbb839fa9339d32f7e6623c1a7a0d8 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 24 Jun 2012 20:23:35 +0200 Subject: [PATCH 10/29] Set edit widget to current group when editing --- terminatorlib/titlebar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index 91e4b2bc..18aada45 100755 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -233,6 +233,8 @@ class Titlebar(gtk.EventBox): def create_group(self): """Create a new group""" + if self.terminal.group: + self.groupentry.set_text(self.terminal.group) self.groupentry.show() self.grouplabel.hide() self.groupentry.grab_focus() From b85f7c402c00a0c91239b640f5c1ba6bf5c1afc0 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 24 Jun 2012 20:36:39 +0200 Subject: [PATCH 11/29] Collection of changes that don't add/remove anything, but needed for next checkin to work --- terminatorlib/terminal.py | 2 ++ terminatorlib/terminator.py | 21 +++++++++++++-------- terminatorlib/titlebar.py | 11 +++++++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index dd58fd9a..47e55838 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -107,6 +107,7 @@ class Terminal(gtk.VBox): composite_support = None cnxids = None + targets_for_new_group = None def __init__(self): """Class initialiser""" @@ -119,6 +120,7 @@ class Terminal(gtk.VBox): # FIXME: Surely these should happen in Terminator::register_terminal()? self.connect('enumerate', self.terminator.do_enumerate) self.connect('focus-in', self.terminator.focus_changed) + self.connect('focus-out', self.terminator.focus_left) self.matches = {} self.cnxids = Signalman() diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 54226838..5bea899a 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -349,19 +349,21 @@ class Terminator(Borg): idx = terminals.index(term) term.feed(numstr % (idx + 1)) + def get_sibling_terms(self, widget): + termset = [] + for term in self.terminals: + if term.group == widget.group: + termset.append(term) + return(termset) + def get_target_terms(self, widget): """Get the terminals we should currently be broadcasting to""" if self.groupsend == self.groupsend_type['all']: return(self.terminals) elif self.groupsend == self.groupsend_type['group']: - termset = [] - for term in self.terminals: - if term == widget or (term.group != None and term.group == - widget.group): - termset.append(term) - return(termset) - else: - return([widget]) + if widget.group != None: + return(self.get_sibling_terms(widget)) + return([widget]) def get_focussed_terminal(self): """iterate over all the terminals to find which, if any, has focus""" @@ -376,6 +378,9 @@ class Terminator(Borg): terminal.titlebar.update(widget) return + def focus_left(self, widget): + self.last_focused_term=widget + def describe_layout(self): """Describe our current layout""" layout = {} diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index 18aada45..e9ee73fb 100755 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -93,7 +93,7 @@ class Titlebar(gtk.EventBox): def connect_icon(self, func): """Connect the supplied function to clicking on the group icon""" - self.ebox.connect('button-release-event', func) + self.ebox.connect('button-press-event', func) def update(self, other=None): """Update our contents""" @@ -252,7 +252,14 @@ class Titlebar(gtk.EventBox): groupname = self.groupentry.get_text() dbg('Titlebar::groupentry_activate: creating group: %s' % groupname) self.groupentry_cancel(None, None) - self.emit('create-group', groupname) + last_focused_term=self.terminator.last_focused_term + if self.terminal.targets_for_new_group: + [term.titlebar.emit('create-group', groupname) for term in self.terminal.targets_for_new_group] + self.terminal.targets_for_new_group = None + else: + self.emit('create-group', groupname) + last_focused_term.grab_focus() + self.terminator.focus_changed(last_focused_term) def groupentry_keypress(self, widget, event): """Handle keypresses on the entry widget""" From 618e38d18bffaccca53cbb2d97934348ef9fcd92 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 24 Jun 2012 20:42:12 +0200 Subject: [PATCH 12/29] Clicking with modifier on the group button gives more powerful control. (Shift: Rename, Ctrl: Join current, Super: Include siblings) --- terminatorlib/terminal.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 47e55838..5add2820 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -772,7 +772,40 @@ class Terminal(gtk.VBox): def on_group_button_press(self, widget, event): """Handler for the group button""" if event.button == 1: - self.create_popup_group_menu(widget, event) + if event.type == gtk.gdk._2BUTTON_PRESS or \ + event.type == gtk.gdk._3BUTTON_PRESS: + # Ignore these, or they make the interaction bad + return False + # Super key applies interaction to all terms in group + include_siblings=event.state & gtk.gdk.MOD4_MASK == gtk.gdk.MOD4_MASK + if include_siblings: + targets=self.terminator.get_sibling_terms(self) + else: + targets=[self] + if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK: + dbg('on_group_button_press: toggle terminal to focused terminals group') + focused=self.get_toplevel().get_focussed_terminal() + if focused in targets: targets.remove(focused) + if self != focused: + if self.group==focused.group: + new_group=None + else: + new_group=focused.group + [term.set_group(None, new_group) for term in targets] + [term.titlebar.update(focused) for term in targets] + return True + elif event.state & gtk.gdk.SHIFT_MASK == gtk.gdk.SHIFT_MASK: + dbg('on_group_button_press: rename of terminals group') + self.targets_for_new_group = targets + self.titlebar.create_group() + return True + elif event.type == gtk.gdk.BUTTON_PRESS: + # Single Click gives popup + dbg('on_group_button_press: group menu popup') + self.create_popup_group_menu(widget, event) + return True + else: + dbg('on_group_button_press: unknown group button interaction') return(False) def on_keypress(self, widget, event): From 4f874bc8c9864689794ccf8ec939e13a3d310b05 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of gnome-terminator <> Date: Fri, 5 Oct 2012 04:32:37 +0000 Subject: [PATCH 13/29] Launchpad automatic translations update. --- po/es.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/po/es.po b/po/es.po index 1e311526..d2b4e523 100644 --- a/po/es.po +++ b/po/es.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-08-21 01:31+0100\n" -"PO-Revision-Date: 2012-05-04 22:28+0000\n" -"Last-Translator: Juan Pablo \n" +"PO-Revision-Date: 2012-10-05 03:56+0000\n" +"Last-Translator: Paco Molinero \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-05-24 10:30+0000\n" -"X-Generator: Launchpad (build 15288)\n" +"X-Launchpad-Export-Date: 2012-10-05 04:32+0000\n" +"X-Generator: Launchpad (build 16061)\n" #: ../data/terminator.desktop.in.h:1 msgid "Multiple terminals in one window" @@ -333,7 +333,7 @@ msgstr "Captura de terminal" #: ../terminatorlib/prefseditor.py:942 ../terminatorlib/prefseditor.py:947 msgid "New Profile" -msgstr "Nuevo Perfil" +msgstr "Perfil nuevo" #: ../terminatorlib/prefseditor.py:987 ../terminatorlib/prefseditor.py:992 msgid "New Layout" From 9e98c08e1dd9464e5e8e2cdf9ba5100c4adca987 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of gnome-terminator <> Date: Sat, 6 Oct 2012 04:33:28 +0000 Subject: [PATCH 14/29] Launchpad automatic translations update. --- po/es.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/es.po b/po/es.po index d2b4e523..1044ec43 100644 --- a/po/es.po +++ b/po/es.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-05 04:32+0000\n" +"X-Launchpad-Export-Date: 2012-10-06 04:33+0000\n" "X-Generator: Launchpad (build 16061)\n" #: ../data/terminator.desktop.in.h:1 From 9fd65d2a4ed6843527c8bd562f95e69b724fd5b7 Mon Sep 17 00:00:00 2001 From: Andrea Corbellini Date: Wed, 10 Oct 2012 18:37:30 +0200 Subject: [PATCH 15/29] Really bring new windows to front, even when terminator does not have the focus --- terminatorlib/window.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index bd2f52d6..72f7845b 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -373,8 +373,10 @@ class Window(Container, gtk.Window): def show(self, startup=False): """Undo the startup show request if started in hidden mode""" - gtk.Window.show(self) - #Present is necessary to grab focus when window is hidden from taskbar + #Present is necessary to grab focus when window is hidden from taskbar. + #It is important to call present() before show(), otherwise the window + #won't be brought to front if an another application has the focus. + #Last note: present() will implicitly call gtk.Window.show() self.present() #Window must be shown, then hidden for the hotkeys to be registered From 646d0e4e5b962d3ee7bf0f4e0827d7035f992d70 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 17 Oct 2012 14:09:29 -0700 Subject: [PATCH 16/29] Update Changelog --- ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6a11c2e8..536d164a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,16 @@ terminator 0.97: menus * When copying a URL, run it through the URL handler first so the resulting URL is copied, rather than the original text + * Allow users to configure a custom URL handler, since the + default GTK library option is failing a lot of users in non-GNOME + environments. + * Allow rotation of a group of terminals (Andre Hilsendeger) + * Add a keyboard shortcut to insert a terminal's number (Stephen J + Boddy) + * Add a keyboard shortcut to edit the window title (Stephen J Boddy) + * Add an easy way to balance terminals by double clicking on their + separator (Stephen J Boddy) + * Bug fixes terminator 0.96: * Unity support for opening new windows (Lucian Adrian Grijincu) From 68847a9bb9d01eaadb89659b23a785726baf3754 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 17 Oct 2012 15:33:15 -0700 Subject: [PATCH 17/29] Fix up custom_url_handler to not show as invalid --- terminatorlib/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 2c05db27..54154bac 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -474,6 +474,9 @@ class ConfigBase(Borg): keytype = '%s(default=%s)' % (keytype, value) + if key == 'custom_url_handler': + keytype = 'string(default="")' + section[key] = keytype configspecdata['global_config'] = section From 6a4e47090bcb9f28d7c7a7bd41fb9a2a75bc51cc Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 11:39:28 -0700 Subject: [PATCH 18/29] Automatically inject a UUID into any factory object, rather than special-casing terminals. This will be very useful for introspection via dbus --- terminatorlib/factory.py | 6 ++++-- terminatorlib/terminal.py | 5 ----- terminatorlib/util.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/terminatorlib/factory.py b/terminatorlib/factory.py index d868ed1c..2ecaa2f7 100755 --- a/terminatorlib/factory.py +++ b/terminatorlib/factory.py @@ -20,7 +20,7 @@ True """ from borg import Borg -from util import dbg, err +from util import dbg, err, inject_uuid # pylint: disable-msg=R0201 # pylint: disable-msg=W0613 @@ -91,7 +91,9 @@ class Factory(Borg): return(None) dbg('Factory::make: created a %s' % product) - return(func(**kwargs)) + output = func(**kwargs) + inject_uuid(output) + return(output) def make_window(self, **kwargs): """Make a Window""" diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 0f274ba0..feca0016 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -14,7 +14,6 @@ import gobject import pango import subprocess import urllib -import uuid from util import dbg, err, gerr import util @@ -89,7 +88,6 @@ class Terminal(gtk.VBox): command = None clipboard = None pid = None - uuid = None matches = None config = None @@ -133,9 +131,6 @@ class Terminal(gtk.VBox): self.pending_on_vte_size_allocate = False - self.uuid = uuid.uuid4() - dbg('assigning Terminal a TERMINATOR_UUID of: %s' % self.uuid.urn) - self.vte = vte.Terminal() self.vte._expose_data = None if not hasattr(self.vte, "set_opacity") or \ diff --git a/terminatorlib/util.py b/terminatorlib/util.py index bd5c2fa8..1592cc7f 100755 --- a/terminatorlib/util.py +++ b/terminatorlib/util.py @@ -28,6 +28,7 @@ import gtk import os import pwd import inspect +import uuid # set this to true to enable debugging output DEBUG = False @@ -276,3 +277,16 @@ def enumerate_descendants(parent): len(terminals), parent)) return(containers, terminals) +def make_uuid(): + """Generate a UUID for an object""" + return uuid.uuid4() + +def inject_uuid(target): + """Inject a UUID into an existing object""" + uuid = make_uuid() + if not hasattr(target, "uuid") or target.uuid == None: + dbg("Injecting UUID %s into: %s" % (uuid, target)) + target.uuid = uuid + else: + dbg("Object already has a UUID: %s" % target) + From 55e8b65aed3a0004284151cf8976c1fd4d63f472 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 13:58:38 -0700 Subject: [PATCH 19/29] Add support for fetching the current tab title via DBus. Closes LP#1067910 --- remotinator | 4 +++- terminatorlib/ipc.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/remotinator b/remotinator index f720851d..d464ee54 100755 --- a/remotinator +++ b/remotinator @@ -24,7 +24,7 @@ import sys from terminatorlib.util import dbg, err try: from terminatorlib import ipc -except ImportErrror: +except ImportError: err('Unable to initialise Terminator remote library. This probably means dbus is not available') sys.exit(1) @@ -35,6 +35,8 @@ COMMANDS={ 'hsplit': ['terminal_hsplit', 'Split the current terminal horizontally'], 'vsplit': ['terminal_vsplit', 'Split the current terminal vertically'], 'terminals': ['get_terminals', 'Get a list of all terminals'], + 'terminal_tab': ['get_terminal_tab', 'Get the UUID of a parent tab'], + 'terminal_tab_title': ['get_terminal_tab_title', 'Get the title of a parent tab'], } if __name__ == '__main__': diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index d413be84..47888a62 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -10,6 +10,7 @@ import dbus.glib from borg import Borg from terminator import Terminator from config import Config +from factory import Factory from util import dbg CONFIG = Config() @@ -93,6 +94,26 @@ class DBusService(Borg, dbus.service.Object): """Return a list of all the terminals""" return [x.uuid.urn for x in self.terminator.terminals] + @dbus.service.method(BUS_NAME) + def get_terminal_tab(self, uuid): + """Return the UUID of the parent tab of a given terminal""" + maker = Factory() + terminal = self.terminator.find_terminal_by_uuid(uuid) + window = terminal.get_toplevel() + root_widget = window.get_children()[0] + if maker.isinstance(root_widget, 'Notebook'): + return root_widget.uuid.urn + + @dbus.service.method(BUS_NAME) + def get_terminal_tab_title(self, uuid): + """Return the title of a parent tab of a given terminal""" + maker = Factory() + terminal = self.terminator.find_terminal_by_uuid(uuid) + window = terminal.get_toplevel() + root_widget = window.get_children()[0] + if maker.isinstance(root_widget, "Notebook"): + return root_widget.get_tab_label(terminal).get_label() + def with_proxy(func): """Decorator function to connect to the session dbus bus""" dbg('dbus client call: %s' % func.func_name) @@ -122,3 +143,13 @@ def get_terminals(session, uuid): """Call the dbus method to return a list of all terminals""" print '\n'.join(session.get_terminals(uuid)) +@with_proxy +def get_terminal_tab(session, uuid): + """Call the dbus method to return the toplevel tab for a terminal""" + print session.get_terminal_tab(uuid) + +@with_proxy +def get_terminal_tab_title(session, uuid): + """Call the dbus method to return the title of a tab""" + print session.get_terminal_tab_title(uuid) + From 5185657010c12c242b20db242d68dc139db907bb Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 14:12:44 -0700 Subject: [PATCH 20/29] Strip newline from text being dragged into the terminal --- terminatorlib/terminal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index feca0016..ba630f34 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -977,9 +977,10 @@ class Terminal(gtk.VBox): if gtk.targets_include_text(drag_context.targets) or \ gtk.targets_include_uri(drag_context.targets): # copy text to destination - txt = selection_data.data.strip() + txt = selection_data.data.strip(' ') if txt[0:7] == 'file://': txt = "'%s'" % urllib.unquote(txt[7:]) + txt = selection_data.data.strip('\n') for term in self.terminator.get_target_terms(self): term.feed(txt) return From a6c48a8bf331f8d06ef586153720dfe424e88228 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 14:15:17 -0700 Subject: [PATCH 21/29] =?UTF-8?q?Apply=20a=20patch=20to=20fix=20a=20manpag?= =?UTF-8?q?e=20typo.=20Patch=20from=20Juli=C3=83=C2=A1n=20Moreno=20Pati?= =?UTF-8?q?=C3=83=C2=B1o=20.=20Closes=20LP#1035691?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/terminator_config.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 677383ca..d0b188d5 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -423,7 +423,7 @@ Default value: \fBFalse\fR .TP .B focus_on_close Sets which terminal should get the focus when another terminal is closed. Values can be "prev", "next" or "auto". -Using "auto", if the closed terminal is within a splitted window, the focus will be on the sibling terminal rather than another tab. +Using "auto", if the closed terminal is within a split window, the focus will be on the sibling terminal rather than another tab. Default value: \fBauto\fR .TP .B exit_action From a98a17b259383314e90fc9ad6c8388c95797774f Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 14:33:13 -0700 Subject: [PATCH 22/29] Add a plugin to log the contents of terminals. Plugin by Sinan Nalkaya . Closes LP#944604 --- terminatorlib/plugins/logger.py | 108 ++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 terminatorlib/plugins/logger.py diff --git a/terminatorlib/plugins/logger.py b/terminatorlib/plugins/logger.py new file mode 100644 index 00000000..a02407fa --- /dev/null +++ b/terminatorlib/plugins/logger.py @@ -0,0 +1,108 @@ +#!/usr/bin/python + +# Plugin by Sinan Nalkaya +# See LICENSE of Terminator package. + +""" logger.py - Terminator Plugin to log 'content' of individual +terminals """ + +import os +import sys +import gtk +import terminatorlib.plugin as plugin +from terminatorlib.translation import _ + +AVAILABLE = ['Logger'] + +class Logger(plugin.MenuItem): + """ Add custom command to the terminal menu""" + capabilities = ['terminal_menu'] + loggers = None + dialog_action = gtk.FILE_CHOOSER_ACTION_SAVE + dialog_buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_SAVE, gtk.RESPONSE_OK) + + def __init__(self): + plugin.MenuItem.__init__(self) + if not self.loggers: + self.loggers = {} + + def callback(self, menuitems, menu, terminal): + """ Add save menu item to the menu""" + vte_terminal = terminal.get_vte() + if not self.loggers.has_key(vte_terminal): + item = gtk.MenuItem(_('Start Logger')) + item.connect("activate", self.start_logger, terminal) + else: + item = gtk.MenuItem(_('Stop Logger')) + item.connect("activate", self.stop_logger, terminal) + item.set_has_tooltip(True) + item.set_tooltip_text("Saving at '" + self.loggers[vte_terminal]["filepath"] + "'") + menuitems.append(item) + + def write_content(self, terminal, row_start, col_start, row_end, col_end): + """ Final function to write a file """ + content = terminal.get_text_range(row_start, col_start, row_end, col_end, + lambda *a: True) + fd = self.loggers[terminal]["fd"] + # Don't write the last char which is always '\n' + fd.write(content[:-1]) + self.loggers[terminal]["col"] = col_end + self.loggers[terminal]["row"] = row_end + + def save(self, terminal): + """ 'contents-changed' callback """ + last_saved_col = self.loggers[terminal]["col"] + last_saved_row = self.loggers[terminal]["row"] + (col, row) = terminal.get_cursor_position() + # Save only when buffer is nearly full, + # for the sake of efficiency + if row - last_saved_row < terminal.get_row_count(): + return + self.write_content(terminal, last_saved_row, last_saved_col, row, col) + + def start_logger(self, _widget, Terminal): + """ Handle menu item callback by saving text to a file""" + savedialog = gtk.FileChooserDialog(title="Save Log File As", + action=self.dialog_action, + buttons=self.dialog_buttons) + savedialog.set_do_overwrite_confirmation(True) + savedialog.set_local_only(True) + savedialog.show_all() + response = savedialog.run() + if response == gtk.RESPONSE_OK: + try: + logfile = os.path.join(savedialog.get_current_folder(), + savedialog.get_filename()) + fd = open(logfile, 'w+') + # Save log file path, + # associated file descriptor, signal handler id + # and last saved col,row positions respectively. + vte_terminal = Terminal.get_vte() + (col, row) = vte_terminal.get_cursor_position() + + self.loggers[vte_terminal] = {"filepath":logfile, + "handler_id":0, "fd":fd, + "col":col, "row":row} + # Add contents-changed callback + self.loggers[vte_terminal]["handler_id"] = vte_terminal.connect('contents-changed', self.save) + except: + e = sys.exc_info()[1] + error = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, + gtk.BUTTONS_OK, e.strerror) + error.run() + error.destroy() + savedialog.destroy() + + def stop_logger(self, _widget, terminal): + vte_terminal = terminal.get_vte() + last_saved_col = self.loggers[vte_terminal]["col"] + last_saved_row = self.loggers[vte_terminal]["row"] + (col, row) = vte_terminal.get_cursor_position() + if last_saved_col != col or last_saved_row != row: + # Save unwritten bufer to the file + self.write_content(vte_terminal, last_saved_row, last_saved_col, row, col) + fd = self.loggers[vte_terminal]["fd"] + fd.close() + vte_terminal.disconnect(self.loggers[vte_terminal]["handler_id"]) + del(self.loggers[vte_terminal]) From 3f0b50f7f92b90c04235c250f2c4c71cdd99af44 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 14:34:22 -0700 Subject: [PATCH 23/29] Update changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 536d164a..c4010900 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ terminator 0.97: * Add a keyboard shortcut to edit the window title (Stephen J Boddy) * Add an easy way to balance terminals by double clicking on their separator (Stephen J Boddy) + * Add a plugin by Sinan Nalkaya to log the contents of terminals. * Bug fixes terminator 0.96: From 6da60c043b4fad01246f204b0b02dac68c9e4a22 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 14:37:46 -0700 Subject: [PATCH 24/29] Attempt to fix a hang in tunnellet X11 situations. Closes LP#943171 --- terminatorlib/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 54154bac..5844a8e4 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -351,9 +351,10 @@ class Config(object): self.gconf = gconf.client_get_default() value = self.gconf.get('/apps/metacity/general/focus_mode') - self.system_focus = value.get_string() - self.gconf.notify_add('/apps/metacity/general/focus_mode', - self.on_gconf_notify) + if value: + self.system_focus = value.get_string() + self.gconf.notify_add('/apps/metacity/general/focus_mode', + self.on_gconf_notify) return(self.system_focus) def on_gconf_notify(self, _client, _cnxn_id, _entry, _what): From 96a6b9c777aef9ed9b9fc4238eae73e36c96e2c0 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 15:03:48 -0700 Subject: [PATCH 25/29] Fix tab label layout when the tab bar is on the right. Closes LP#838426 --- terminatorlib/notebook.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index bef0caf9..f4b21af9 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -472,6 +472,8 @@ class TabLabel(gtk.HBox): self.set_orientation(gtk.ORIENTATION_VERTICAL) self.label.set_angle(90) elif position == gtk.POS_RIGHT: + if hasattr(self, 'set_orientation'): + self.set_orientation(gtk.ORIENTATION_VERTICAL) self.label.set_angle(270) else: if hasattr(self, 'set_orientation'): From eda8d3fc220945f908aa33cf5554aff4c0c829dd Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 16:23:25 -0700 Subject: [PATCH 26/29] Partially prevent focus grabbing by terminals leaving a Paned where they had no focus to begin with. This is useful where terminals are exiting for reasons other than direct user intervention. LP#943311 --- terminatorlib/paned.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 01b297e6..6d623498 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -111,7 +111,10 @@ class Paned(Container): handler = handler[0] self.connect_child(widget, signal, handler, *args) - widget.grab_focus() + if metadata and \ + metadata.has_key('had_focus') and \ + metadata['had_focus'] == True: + widget.grab_focus() elif isinstance(widget, gtk.Paned): try: @@ -220,9 +223,15 @@ class Paned(Container): children.append(self.get_child2()) return(children) + def get_child_metadata(self, widget): + """Return metadata about a child""" + metadata = {} + metadata['had_focus'] = widget.has_focus() + def wrapcloseterm(self, widget): """A child terminal has closed, so this container must die""" dbg('Paned::wrapcloseterm: Called on %s' % widget) + if self.closeterm(widget): # At this point we only have one child, which is the surviving term sibling = self.children[0] @@ -235,7 +244,6 @@ class Paned(Container): parent.remove(self) self.cnxids.remove_all() parent.add(sibling, metadata) - sibling.grab_focus() del(self) else: dbg("Paned::wrapcloseterm: self.closeterm failed") From 4516d991a53d7a3ddc80f1f71076cc1ecca135d5 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 18 Oct 2012 20:51:39 -0700 Subject: [PATCH 27/29] Support custom TERM and COLORTERM env vars. Patch from John Feuerstein. Closes LP#794561 --- doc/terminator_config.5 | 8 ++++++++ terminatorlib/config.py | 2 ++ terminatorlib/terminal.py | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index c4637051..d29b4892 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -382,6 +382,14 @@ Default value: \fBblock\fR Sets what type of terminal should be emulated. Default value: \fBxterm\fR .TP +.B xterm +This translates into the value that will be set for TERM in the environment of your terminals. +Default value: \fBxterm\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 +.TP .B use_system_font Whether or not to use the GNOME default monospace font for terminals. Default value: \fBTrue\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index ee47416a..52ac74dd 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -186,6 +186,8 @@ DEFAULTS = { 'cursor_shape' : 'block', 'cursor_color' : '#aaaaaa', 'emulation' : 'xterm', + 'term' : 'xterm', + 'colorterm' : 'gnome-terminal', 'font' : 'Mono 10', 'foreground_color' : '#aaaaaa', 'show_titlebar' : True, diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index ba630f34..3a0edf78 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -164,8 +164,8 @@ class Terminal(gtk.VBox): self.connect_signals() - os.putenv('TERM', 'xterm') - os.putenv('COLORTERM', 'gnome-terminal') + os.putenv('TERM', self.config['term']) + os.putenv('COLORTERM', self.config['colorterm']) env_proxy = os.getenv('http_proxy') if not env_proxy: @@ -1278,6 +1278,8 @@ class Terminal(gtk.VBox): pass envv = [] + envv.append('TERM=%s' % self.config['term']) + envv.append('COLORTERM=%s' % self.config['colorterm']) envv.append('TERMINATOR_UUID=%s' % self.uuid.urn) if self.terminator.dbus_name: envv.append('TERMINATOR_DBUS_NAME=%s' % self.terminator.dbus_name) From ad846ce402afb3b128e5b0803e79c8ed60e5002e Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 19 Oct 2012 09:57:23 -0700 Subject: [PATCH 28/29] Apply patch from Seonghun Lim to fix the split_to_group feature. Closes LP#838655 --- terminatorlib/notebook.py | 2 ++ terminatorlib/paned.py | 2 ++ terminatorlib/window.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index bfbdc445..6fd653a4 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -136,6 +136,8 @@ class Notebook(Container, gtk.Notebook): sibling = maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if widget.group and self.config['split_to_group']: + sibling.set_group(None, widget.group) if self.config['always_split_with_profile']: sibling.force_set_profile(None, widget.get_profile()) diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index eb1c8920..22259b4f 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -50,6 +50,8 @@ class Paned(Container): sibling = self.maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if widget.group and self.config['split_to_group']: + sibling.set_group(None, widget.group) if self.config['always_split_with_profile']: sibling.force_set_profile(None, widget.get_profile()) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 90a3cf5d..7031400a 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -459,6 +459,8 @@ class Window(Container, gtk.Window): sibling = maker.make('Terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if widget.group and self.config['split_to_group']: + sibling.set_group(None, widget.group) if self.config['always_split_with_profile']: sibling.force_set_profile(None, widget.get_profile()) From cd0d57021a44392f6fe2c43b87fcaed7b678265c Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 19 Oct 2012 12:59:18 -0700 Subject: [PATCH 29/29] Bump versions to 1.0 --- ChangeLog | 6 +++++- debian/changelog | 6 ++++++ terminator.spec | 2 +- terminatorlib/version.py | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4010900..02dd90ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -terminator 0.97: +terminator 1.0: * Allow font dimming in inactive terminals * Allow URL handler plugins to override label text for URL context menus @@ -14,6 +14,10 @@ terminator 0.97: * Add an easy way to balance terminals by double clicking on their separator (Stephen J Boddy) * Add a plugin by Sinan Nalkaya to log the contents of terminals. + * Support configuration of TERM and COLORTERM, via a patch from + John Feuerstein + * Support reading configuration from alternate files, via a patch + from Pavel Khlebovich * Bug fixes terminator 0.96: diff --git a/debian/changelog b/debian/changelog index 7bcca422..28776b87 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +terminator (1.0) precise; urgency=low + + * New upstream release of 1.0 + + -- Chris Jones Fri, 19 Oct 2012 12:57:42 -0700 + terminator (0.96ppa6) oneiric; urgency=low * No-change rebuild for oneiric PPA diff --git a/terminator.spec b/terminator.spec index 0692fb06..0e127cae 100644 --- a/terminator.spec +++ b/terminator.spec @@ -1,7 +1,7 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: terminator -Version: 0.96 +Version: 1.0 Release: 1%{?dist} Summary: Store and run multiple GNOME terminals in one window diff --git a/terminatorlib/version.py b/terminatorlib/version.py index 60e01b93..eccb891d 100644 --- a/terminatorlib/version.py +++ b/terminatorlib/version.py @@ -21,4 +21,4 @@ TerminatorVersion supplies our version number. """ APP_NAME = 'terminator' -APP_VERSION = '0.96' +APP_VERSION = '1.0'