From a075a6cc62a1df94249e46910455f1721fae4a28 Mon Sep 17 00:00:00 2001 From: Chris James Date: Mon, 28 Jul 2008 02:10:30 -0500 Subject: [PATCH] Quake mode --- terminator | 14 ++++++++++++-- terminatorlib/config.py | 1 + terminatorlib/terminator.py | 29 ++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/terminator b/terminator index 01fa5d94..e7737f94 100755 --- a/terminator +++ b/terminator @@ -21,6 +21,9 @@ import os, sys from optparse import OptionParser +# import keybinder for quake mode +import deskbar.core.keybinder as bindkey + from terminatorlib.version import APP_NAME, APP_VERSION try: @@ -48,6 +51,7 @@ except ImportError: from terminatorlib.terminator import Terminator + if __name__ == '__main__': def execute_cb (option, opt, value, parser): """Callback for use in parsing Terminator command line options""" @@ -87,6 +91,7 @@ if __name__ == '__main__': 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", @@ -144,8 +149,13 @@ See the following bug report for more details: pass dbg ('profile_cb: settled on profile: "%s"' % options.profile) - term = Terminator (options.profile, command, options.fullscreen, options.maximise, - options.borderless, options.no_gconf) + term = Terminator (options.profile, command, options.fullscreen, options.maximise, options.borderless, options.no_gconf, options.hidden) + + # binding for quake mode + def cbkeyCloak(term): + term.cbkeyCloak() + bindkey.tomboy_keybinder_bind("a",cbkeyCloak,term) gtk.main () + diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 0f955d0f..9f63c1c1 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -120,6 +120,7 @@ class TerminatorConfValuestore: 'extreme_tabs' : False, 'fullscreen' : False, 'borderless' : False, + 'hidden' : False, 'maximise' : False, 'handle_size' : -1, 'focus_on_close' : 'auto', diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 90ab68be..4c311006 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -87,7 +87,7 @@ class TerminatorNotebookTabLabel(gtk.HBox): return self.size_request()[0] class Terminator: - def __init__ (self, profile = None, command = None, fullscreen = False, maximise = False, borderless = False, no_gconf=False): + def __init__ (self, profile = None, command = None, fullscreen = False, maximise = False, borderless = False, no_gconf=False, hidden=False): self.profile = profile self.command = command @@ -95,6 +95,8 @@ class Terminator: self._maximised = False self._fullscreen = False self._f11_modifier = False + self.hidden = False + self.term_list = [] stores = [] stores.append (config.TerminatorConfValuestoreRC ()) @@ -167,6 +169,9 @@ class Terminator: if borderless or self.conf.borderless: self.window.set_decorated (False) + if hidden or self.conf.hidden: + self.hide() + # Set RGBA colormap if possible so VTE can use real alpha # channels for transparency. if self.conf.enable_real_transparency: @@ -185,6 +190,28 @@ class Terminator: self.window.show () term.spawn_child () + # jgc: show/hide functions for quake mode + def show(self): + """Show the terminator window""" + # restore window position + self.window.move(self.pos[0],self.pos[1]) + self.window.present() + 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): + """Callback event for show/hide keypress""" + if self.hidden: + self.show() + else: + self.hide() + def maximize (self): """ Maximize the Terminator window.""" self.window.maximize ()