Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-10-01 18:10:58 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-10-01 18:10:58 (GMT)
commit6aba3ca550cb34cc757c1df17ed271534d55ee38 (patch)
treea000f9e2487c14b43129a7e8aa0233a76bc329b5
parent293a3fc5a11fb4309eba4414702570b778508f4f (diff)
sugar-emulator starts sugar out of Xephyr #1432
-rw-r--r--bin/sugar-emulator17
-rw-r--r--bin/sugar.in33
2 files changed, 41 insertions, 9 deletions
diff --git a/bin/sugar-emulator b/bin/sugar-emulator
index 7f06609..99856dc 100644
--- a/bin/sugar-emulator
+++ b/bin/sugar-emulator
@@ -73,8 +73,9 @@ def _start_xephyr(dpi, dimensions, fullscreen):
# FIXME evil workaround until F10 Xephyr is fixed
if os.path.exists('/etc/fedora-release'):
if open('/etc/fedora-release').read().startswith('Fedora release 10'):
- _run_xephyr(random.randint(100, 500), dpi, dimensions, fullscreen)
- return
+ display = random.randint(100, 500)
+ _run_xephyr(display, dpi, dimensions, fullscreen)
+ return display
for display in range(100, 110):
if not _check_xephyr(display):
@@ -83,15 +84,15 @@ def _start_xephyr(dpi, dimensions, fullscreen):
tries = 10
while tries > 0:
if _check_xephyr(display):
- return
+ return display
else:
tries -= 1
time.sleep(0.1)
-def _start_window_manager():
+def _start_window_manager(display):
cmd = ['metacity']
- cmd.extend(['--no-force-fullscreen'])
+ cmd.extend(['--no-force-fullscreen', '-d', ':%d' % display])
gobject.spawn_async(cmd, flags=gobject.SPAWN_SEARCH_PATH)
@@ -146,7 +147,7 @@ def main():
_setup_env()
- _start_xephyr(options.dpi, options.dimensions, options.fullscreen)
+ display = _start_xephyr(options.dpi, options.dimensions, options.fullscreen)
if options.scaling:
os.environ['SUGAR_SCALING'] = options.scaling
@@ -154,9 +155,9 @@ def main():
command = ['dbus-launch', 'dbus-launch', '--exit-with-session']
if not args:
- command.append('sugar')
+ command.extend(['sugar', '-d', ':%d' % display])
else:
- _start_window_manager()
+ _start_window_manager(display)
if args[0].endswith('.py'):
command.append('python')
diff --git a/bin/sugar.in b/bin/sugar.in
index 47cca31..094917f 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -1,5 +1,19 @@
#!/bin/sh
+usage() {
+ cat <<EOF
+Usage: sugar [OPTION]..
+
+Start Sugar window manager.
+
+Optional arguments.
+ -d, --display DISPLAY Display to start sugar
+ -s, --scaling SCALING Scale Sugar theme
+ Supported values: 72, 100
+EOF
+ exit 0
+}
+
init_cursor() {
# have to reset cursor(metacity sets it on startup)
# ugly but works
@@ -9,6 +23,23 @@ init_cursor() {
done
}
+while [ $# -ne 0 ] ; do
+ case "$1" in
+ -d | --display)
+ shift
+ export DISPLAY="$1"
+ ;;
+ -s | --scaling)
+ shift
+ export SUGAR_SCALING="$1"
+ ;;
+ -h | --help)
+ usage
+ ;;
+ esac
+ shift
+done
+
if test -z "$SUGAR_SCALING"; then
export SUGAR_SCALING=72
fi
@@ -29,7 +60,7 @@ if [ -f ~/.sugar/debug ]; then
fi
echo Xcursor.theme: sugar | xrdb -merge
-metacity --no-force-fullscreen &
+metacity --no-force-fullscreen -d $DISPLAY &
init_cursor &
exec sugar-session