diff --git a/doc/terminator.1 b/doc/terminator.1 index 80767abe..8133a9ce 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -33,6 +33,10 @@ Place the Terminator window in its fullscreen state when it starts Instruct the window manager not to render borders/decoration on the Terminator window (good with \-m) .TP +.B \-H, \-\-hidden +Hide the Terminator window by default. Its visibility can be toggled +with the \fBquake\fR keyboard shortcut (Ctrl-Shift-Alt-a by default) +.TP .B \-\-no_gconf Ignore the gconf settings of gnome-terminal .TP diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 5af70102..5c05efb8 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -168,6 +168,10 @@ Default value: \fBFalse\fR Controls whether the Terminator window will be started without window borders Default value: \fBFalse\fR .TP +.B hidden \fR(boolean) +Hides the Terminator window by default. Its visibility can be toggled with the \fBquake\fR keybinding (Ctrl-Shift-Alt-a by default) +Default value: \fBFalse\fR +.TP .B handle_size Controls the width of the separator between terminals. Anything outside the range 0-5 (inclusive) will be ignored and use your default theme value. Default value: \fB-1\fR diff --git a/terminator b/terminator index cb5eac3e..2e9d0254 100755 --- a/terminator +++ b/terminator @@ -88,6 +88,8 @@ if __name__ == '__main__': dest="fullscreen", help="Set the window into fullscreen mode") parser.add_option ("-b", "--borderless", action="store_true", dest="borderless", help="Turn off the window's borders") + parser.add_option("-H", "--hidden", action="store_true", dest="hidden", + help="Open the %s window hidden"%APP_NAME.capitalize()) parser.add_option ("-n", "--no-gconf", dest="no_gconf", action="store_true", help="ignore gnome-terminal gconf settings") parser.add_option ("-p", "--profile", dest="profile", action="callback", @@ -153,7 +155,7 @@ See the following bug report for more details: dbg ('profile_cb: settled on profile: "%s"' % options.profile) term = Terminator (options.profile, command, options.fullscreen, options.maximise, options.borderless, options.no_gconf, - options.geometry) + options.geometry, options.hidden) if options.debug > 1: import terminatorlib.debugserver as debugserver diff --git a/terminatorlib/config.py b/terminatorlib/config.py index ad8602ed..0b562ef4 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -96,6 +96,7 @@ Defaults = { 'fullscreen' : False, 'borderless' : False, 'maximise' : False, + 'hidden' : False, 'handle_size' : -1, 'focus_on_close' : 'auto', 'f11_modifier' : False, @@ -139,6 +140,7 @@ Defaults = { 'full_screen' : 'F11', 'reset' : 'R', 'reset_clear' : 'G', + 'quake' : 'a', } } diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 3e6388c7..341891f8 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -31,6 +31,14 @@ from terminatorlib.keybindings import TerminatorKeybindings from terminatorlib.terminatorterm import TerminatorTerm from terminatorlib.prefs_profile import ProfileEditor +# import keybinder for quake mode +try: + import deskbar.core.keybinder as bindkey +except: + print (_("Unable to find python bindings for deskbar, "\ + "QUAKE mode is not available.")) + pass + class TerminatorNotebookTabLabel(gtk.HBox): _terminator = None _notebook = None @@ -124,7 +132,7 @@ class Terminator: def __init__ (self, profile = None, command = None, fullscreen = False, maximise = False, borderless = False, no_gconf = False, - geometry = None): + geometry = None, hidden = False): self.profile = profile self.command = command @@ -134,6 +142,7 @@ class Terminator: self._geometry = geometry self.debugaddress = None self.start_cwd = os.getcwd() + self._hidden = False self.term_list = [] self.gnome_client = None stores = [] @@ -200,7 +209,6 @@ class Terminator: import webbrowser self.url_show = webbrowser.open - self.icon_theme = gtk.IconTheme () self.keybindings = TerminatorKeybindings() @@ -261,6 +269,14 @@ class Terminator: term.spawn_child () self.save_yourself () + if hidden or self.conf.hidden: + self.hide() + + try: + bindkey.tomboy_keybinder_bind(self.conf.keybindings['quake'],self.cbkeyCloak,term) + except: + pass + def set_handle_size (self, size): if size in xrange (0,6): gtk.rc_parse_string(""" @@ -339,6 +355,28 @@ class Terminator: c.set_clone_command(len(args), args) return True + def show(self): + """Show the terminator window""" + # restore window position + self.window.move(self.pos[0],self.pos[1]) + #self.window.present() + self.window.show_now() + self._hidden = False + + def hide(self): + """Hide the terminator window""" + # save window position + self.pos = self.window.get_position() + self.window.hide() + self._hidden = True + + def cbkeyCloak(self, data): + """Callback event for show/hide keypress""" + if self._hidden: + self.show() + else: + self.hide() + def maximize (self): """ Maximize the Terminator window.""" self.window.maximize () diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 81a4d46c..8a6c13f4 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -730,6 +730,9 @@ text/plain dbg ('on_vte_key_press: Called on %s with no event' % term) return False mapping = self.terminator.keybindings.lookup(event) + + if mapping == "quake": + return False if mapping and mapping not in self.UnhandledKeybindings: dbg("on_vte_key_press: lookup found %r" % mapping)