Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stone <michael@laptop.org>2009-03-08 23:16:36 (GMT)
committer Michael Stone <michael@laptop.org>2009-03-08 23:17:44 (GMT)
commita697f58276f7aabb872196366f989fc637a04503 (patch)
tree09927a2bf2d9efed5aeeae02a7c27d5e88f1b58a
parenta899eba238fc318bdd31dfddaec0fe8b7a8e41b6 (diff)
Cheat by snagging $DISPLAY from the parent environment.
-rwxr-xr-xrainbow/bin/rainbow-easy15
1 files changed, 14 insertions, 1 deletions
diff --git a/rainbow/bin/rainbow-easy b/rainbow/bin/rainbow-easy
index 6fdb421..ecfa9ac 100755
--- a/rainbow/bin/rainbow-easy
+++ b/rainbow/bin/rainbow-easy
@@ -10,4 +10,17 @@ if [ -z "$1" ] || [ -z "$SUDO_USER" ]; then usage || exit 1; fi
ID="$1"; shift
-exec rainbow-run -s /var/spool/rainbow/2 -u "$SUDO_USER" -c `pwd` -f 0 -f 1 -f 2 -i "${SUDO_USER}_${ID}" -E DISPLAY=:0 -o audio -- $@
+if [ -z "$DISPLAY" ]; then
+ DISPLAY=`python <<EOF
+import os
+from os.path import join
+
+ppid = os.getppid()
+env = open(join('/proc', str(ppid),'environ')).read().split('\0')
+for kv in env:
+ if kv.startswith("DISPLAY="):
+ print kv[len("DISPLAY="):]
+EOF`
+fi
+
+exec rainbow-run -s /var/spool/rainbow/2 -u "$SUDO_USER" -c "`pwd`" -f 0 -f 1 -f 2 -i "${SUDO_USER}_${ID}" -E "DISPLAY=$DISPLAY" -o audio -- $@