Quake mode

This commit is contained in:
Chris James 2008-07-28 02:10:30 -05:00
parent 29c2d3e44d
commit a075a6cc62
3 changed files with 41 additions and 3 deletions

View File

@ -21,6 +21,9 @@
import os, sys import os, sys
from optparse import OptionParser from optparse import OptionParser
# import keybinder for quake mode
import deskbar.core.keybinder as bindkey
from terminatorlib.version import APP_NAME, APP_VERSION from terminatorlib.version import APP_NAME, APP_VERSION
try: try:
@ -48,6 +51,7 @@ except ImportError:
from terminatorlib.terminator import Terminator from terminatorlib.terminator import Terminator
if __name__ == '__main__': if __name__ == '__main__':
def execute_cb (option, opt, value, parser): def execute_cb (option, opt, value, parser):
"""Callback for use in parsing Terminator command line options""" """Callback for use in parsing Terminator command line options"""
@ -87,6 +91,7 @@ if __name__ == '__main__':
help="Set the window into fullscreen mode") help="Set the window into fullscreen mode")
parser.add_option ("-b", "--borderless", action="store_true", dest="borderless", parser.add_option ("-b", "--borderless", action="store_true", dest="borderless",
help="Turn off the window's borders") 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", parser.add_option ("-n", "--no-gconf", dest="no_gconf", action="store_true",
help="ignore gnome-terminal gconf settings") help="ignore gnome-terminal gconf settings")
parser.add_option ("-p", "--profile", dest="profile", action="callback", parser.add_option ("-p", "--profile", dest="profile", action="callback",
@ -144,8 +149,13 @@ See the following bug report for more details:
pass pass
dbg ('profile_cb: settled on profile: "%s"' % options.profile) dbg ('profile_cb: settled on profile: "%s"' % options.profile)
term = Terminator (options.profile, command, options.fullscreen, options.maximise, term = Terminator (options.profile, command, options.fullscreen, options.maximise, options.borderless, options.no_gconf, options.hidden)
options.borderless, options.no_gconf)
# binding for quake mode
def cbkeyCloak(term):
term.cbkeyCloak()
bindkey.tomboy_keybinder_bind("<Ctrl><Shift>a",cbkeyCloak,term)
gtk.main () gtk.main ()

View File

@ -120,6 +120,7 @@ class TerminatorConfValuestore:
'extreme_tabs' : False, 'extreme_tabs' : False,
'fullscreen' : False, 'fullscreen' : False,
'borderless' : False, 'borderless' : False,
'hidden' : False,
'maximise' : False, 'maximise' : False,
'handle_size' : -1, 'handle_size' : -1,
'focus_on_close' : 'auto', 'focus_on_close' : 'auto',

View File

@ -87,7 +87,7 @@ class TerminatorNotebookTabLabel(gtk.HBox):
return self.size_request()[0] return self.size_request()[0]
class Terminator: 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.profile = profile
self.command = command self.command = command
@ -95,6 +95,8 @@ class Terminator:
self._maximised = False self._maximised = False
self._fullscreen = False self._fullscreen = False
self._f11_modifier = False self._f11_modifier = False
self.hidden = False
self.term_list = [] self.term_list = []
stores = [] stores = []
stores.append (config.TerminatorConfValuestoreRC ()) stores.append (config.TerminatorConfValuestoreRC ())
@ -167,6 +169,9 @@ class Terminator:
if borderless or self.conf.borderless: if borderless or self.conf.borderless:
self.window.set_decorated (False) self.window.set_decorated (False)
if hidden or self.conf.hidden:
self.hide()
# Set RGBA colormap if possible so VTE can use real alpha # Set RGBA colormap if possible so VTE can use real alpha
# channels for transparency. # channels for transparency.
if self.conf.enable_real_transparency: if self.conf.enable_real_transparency:
@ -185,6 +190,28 @@ class Terminator:
self.window.show () self.window.show ()
term.spawn_child () 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): def maximize (self):
""" Maximize the Terminator window.""" """ Maximize the Terminator window."""
self.window.maximize () self.window.maximize ()