diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-07-09 15:37:54 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-07-09 15:37:54 (GMT) |
commit | 1cc14e406a62a015067446976d149a1f60de5197 (patch) | |
tree | 8f0f66f65da26b55c93e0bd7503f9f315d76cc87 /shell/sugar | |
parent | d4cb9a27149126de64fb003aafb8673633b885b0 (diff) |
More work on the window management refactor
Diffstat (limited to 'shell/sugar')
-rwxr-xr-x | shell/sugar | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/shell/sugar b/shell/sugar index a4fd023..9a857db 100755 --- a/shell/sugar +++ b/shell/sugar @@ -9,6 +9,9 @@ import pygtk pygtk.require('2.0') import gobject +# FIXME How to pick a good display number +XEPHYR_DISPLAY = 100 + def add_to_python_path(path): sys.path.insert(0, path) if os.environ.has_key('PYTHONPATH'): @@ -23,7 +26,6 @@ def start_dbus(): dbus_file = os.fdopen(dbus_stdout) addr = dbus_file.readline() addr = addr.strip() - print "dbus-daemon pid is %d, session bus address is %s" % (dbus_pid, addr) dbus_file.close() os.environ["DBUS_SESSION_BUS_ADDRESS"] = addr @@ -37,6 +39,20 @@ def stop_dbus(dbus_pid): except OSError: pass +def start_xephyr(): + command = 'Xephyr :%d -ac -screen 640x480' % (XEPHYR_DISPLAY) + xephyr_pid = os.spawnvp(os.P_NOWAIT, 'Xephyr', command.split()) + +def stop_xephyr(): + os.kill(xephyr_pid) + +def start_matchbox(): + command = 'matchbox-window-manager -use_titlebar no' + xephyr_pid = os.spawnvp(os.P_NOWAIT, 'matchbox-window-manager', command.split()) + +def stop_matchbox(): + os.kill(xephyr_pid) + i = 0 dbus_daemon_pid = None for arg in sys.argv: @@ -56,7 +72,6 @@ if not os.environ.has_key("SUGAR_NICK_NAME"): os.environ['SUGAR_NICK_NAME'] = nick os.environ['SUGAR_USER_DIR'] = os.path.expanduser('~/.sugar') - curdir = os.path.abspath(os.path.dirname(__file__)) basedir = os.path.dirname(curdir) @@ -68,6 +83,10 @@ else: import sugar.env add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell')) print 'Running the installed sugar...' + +start_xephyr() +os.environ['DISPLAY'] = ":%d" % (XEPHYR_DISPLAY) +start_matchbox() print 'Redirecting output to the console, press Ctrl+Down to open it.' @@ -78,3 +97,6 @@ session.start() if dbus_daemon_pid: stop_dbus(dbus_daemon_pid) + +stop_matchbox() +stop_xephyr() |