Add a --geometry option. Terminator's constructor is getting a bit long.

This commit is contained in:
Thomas Hurst 2008-08-21 08:07:38 +01:00
parent aad468993d
commit fc53521c80
3 changed files with 15 additions and 3 deletions

View File

@ -38,7 +38,10 @@ Ignore the gconf settings of gnome-terminal
.TP
.B \-p, \-\-profile=PROFILE
Loads the GNOME Terminal profile named PROFILE
.TP
.TP
.B \-\-geometry=GEOMETRY
Specifies the preferred size and position of Terminator's window; see X(7).
.TP
.B \-e, \-\-command=COMMAND
Runs the specified command instead of your default shell or profile specified command
.TP

View File

@ -91,6 +91,8 @@ if __name__ == '__main__':
help="ignore gnome-terminal gconf settings")
parser.add_option ("-p", "--profile", dest="profile", action="callback",
callback=profile_cb, help="Specify a GNOME Terminal profile to emulate")
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="Execute the argument to this option inside the terminal")
parser.add_option ("-x", "--execute", dest="execute", action="callback",
@ -145,7 +147,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.borderless, options.no_gconf, options.geometry)
if options.debug > 1:
import terminatorlib.debugserver as debugserver

View File

@ -84,13 +84,16 @@ 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,
geometry = None):
self.profile = profile
self.command = command
self._zoomed = False
self._maximised = False
self._fullscreen = False
self._geometry = geometry
self.debugaddress = None
self.term_list = []
stores = []
@ -149,6 +152,10 @@ class Terminator:
self.window = gtk.Window ()
self.window.set_title (APP_NAME.capitalize())
if self._geometry is not None:
if not self.window.parse_geometry(self._geometry):
err(_("Invalid geometry string %s") % repr(self._geometry))
try:
self.window.set_icon (self.icon_theme.load_icon (APP_NAME, 48, 0))
except: