Session support now tests ok with xsm. Note change of default #! line, and addition of dummy arguments to OptionParser. If we move gnome init earlier we can avoid the latter.
This commit is contained in:
parent
0f5c6b361b
commit
035b15b6d9
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# Terminator - multiple gnome terminals in one window
|
||||
# Copyright (C) 2006-2008 cmsj@tenshu.net
|
||||
#
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
# import standard python libs
|
||||
import os, sys
|
||||
from optparse import OptionParser
|
||||
from optparse import OptionParser, SUPPRESS_HELP
|
||||
|
||||
from terminatorlib.version import APP_NAME, APP_VERSION
|
||||
|
||||
@ -97,6 +97,8 @@ if __name__ == '__main__':
|
||||
help="Execute the argument to this option inside the terminal")
|
||||
parser.add_option ("-x", "--execute", dest="execute", action="callback",
|
||||
callback=execute_cb, help="Execute the remainder of the command line inside the terminal")
|
||||
for opt in ['--sm-client-id', '--sm-config-prefix', '--screen']:
|
||||
parser.add_option (opt, dest="dummy", action="store", help=SUPPRESS_HELP)
|
||||
|
||||
(options, args) = parser.parse_args ()
|
||||
if len (args) != 0:
|
||||
|
@ -197,6 +197,7 @@ class Terminator:
|
||||
self.window.set_title (APP_NAME.capitalize())
|
||||
|
||||
if self._geometry is not None:
|
||||
dbg("Geometry=%s" % self._geometry)
|
||||
if not self.window.parse_geometry(self._geometry):
|
||||
err(_("Invalid geometry string %s") % repr(self._geometry))
|
||||
|
||||
@ -241,13 +242,14 @@ class Terminator:
|
||||
term.spawn_child ()
|
||||
self.save_yourself ()
|
||||
|
||||
def die(self):
|
||||
def die(self, *args):
|
||||
gtk.main_quit ()
|
||||
|
||||
def save_yourself (self):
|
||||
def save_yourself (self, *args):
|
||||
""" Save as much of our state as possible for the X session manager """
|
||||
dbg("Saving session for xsm")
|
||||
args = []
|
||||
args = [sys.argv[0],
|
||||
("--geometry=%dx%d" % self.window.get_size()) + ("+%d+%d" % self.window.get_position())]
|
||||
drop_next_arg = False
|
||||
geompatt = re.compile(r'^--geometry(=.+)?')
|
||||
for arg in sys.argv[1:]:
|
||||
@ -259,22 +261,25 @@ class Terminator:
|
||||
args.append(arg)
|
||||
drop_next_arg = False
|
||||
|
||||
cmd = [sys.executable, sys.argv[0]]
|
||||
# pygtk docs suggest the session manager protocol handles this for us.
|
||||
cmd.append(("--geometry=%dx%d" % self.window.get_size()) + ("+%d+%d" % self.window.get_position()))
|
||||
cmd += args
|
||||
dbg("Session restart command: %s in %s" % (repr(cmd), self.start_cwd))
|
||||
|
||||
# We can't set an interpreter because Gnome unconditionally spams it with
|
||||
# --sm-foo-bar arguments before our own argument list. *mutter*
|
||||
# So, hopefully your #! line is correct. If not, we could write out
|
||||
# a shell script with the interpreter name etc.
|
||||
c = self.gnome_client
|
||||
c.set_program(sys.argv[0])
|
||||
dbg("Session restart command: %s with args %s in %s" % (sys.argv[0], repr(args), self.start_cwd))
|
||||
|
||||
c.set_restart_style(gnome.ui.RESTART_IF_RUNNING)
|
||||
c.set_current_directory(self.start_cwd)
|
||||
try:
|
||||
c.set_restart_command(cmd)
|
||||
except TypeError:
|
||||
c.set_restart_command(args)
|
||||
c.set_clone_command(args)
|
||||
except (TypeError,AttributeError):
|
||||
# Apparantly needed for some Fedora systems
|
||||
# see http://trac.nicfit.net/mesk/ticket/137
|
||||
#
|
||||
c.set_restart_command(len(cmd), cmd)
|
||||
dbg("Gnome bindings have weird set_clone/restart_command")
|
||||
c.set_restart_command(len(args), args)
|
||||
c.set_clone_command(len(args), args)
|
||||
return True
|
||||
|
||||
def maximize (self):
|
||||
|
Loading…
Reference in New Issue
Block a user