Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/commands/helpers/xinitrc
diff options
context:
space:
mode:
Diffstat (limited to 'commands/helpers/xinitrc')
-rw-r--r--commands/helpers/xinitrc58
1 files changed, 58 insertions, 0 deletions
diff --git a/commands/helpers/xinitrc b/commands/helpers/xinitrc
new file mode 100644
index 0000000..9cb52c8
--- /dev/null
+++ b/commands/helpers/xinitrc
@@ -0,0 +1,58 @@
+unset GPG_AGENT_INFO
+unset SSH_AUTH_SOCK
+unset GNOME_KEYRING_CONTROL
+unset GNOME_KEYRING_PID
+unset SESSION_MANAGER
+
+HELPERS_DIR=`dirname "$0"`
+COMMANDS_DIR=`dirname "$HELPERS_DIR"`
+ROOT_DIR=`dirname "$COMMANDS_DIR"`
+
+if [ ! -z $SUGAR_PROFILE ]; then
+ grep -q PROFILE $ROOT_DIR/prefs
+ if [ $? -ne 0 ]; then
+ randomstring=`</dev/urandom tr -cd A-Za-z0-9 | head -c10`
+ echo "PROFILE=$randomstring" >> $ROOT_DIR/prefs
+ fi
+fi
+
+if [ -f $ROOT_DIR/prefs ]; then
+ source $ROOT_DIR/prefs
+fi
+
+# Sugar doesn't handle multiple outputs properly. To avoid issues we keep the
+# first output in the list returned by xrandr and turn off everything else.
+
+OUTPUTS=`$HELPERS_DIR/list-outputs`
+
+for output in $OUTPUTS
+do
+ # Default to the first output in the list
+ if [ -z $OUTPUT ]; then
+ OUTPUT=$output
+ fi
+
+ if [ $OUTPUT != $output ]; then
+ xrandr --output $output --off
+ fi
+done
+
+if [ ! -z $RESOLUTION ]; then
+ xrandr -s $RESOLUTION
+fi
+
+if [ ! -z $SUGAR_UI_TESTS ]; then
+ rm -rf ~/.sugar/ui-tests
+ export SUGAR_PROFILE=ui-tests
+elif [ ! -z $PROFILE ]; then
+ export SUGAR_PROFILE=$PROFILE
+fi
+
+if [ ! -z $SUGAR_XKBCONFIG ]; then
+ cat $SUGAR_XKBCONFIG | xkbcomp - $DISPLAY 2> /dev/null
+ rm $SUGAR_XKBCONFIG
+fi
+
+RUN_COMMAND="dbus-launch --exit-with-session $HELPERS_DIR/run-with-keyring sugar"
+
+$COMMANDS_DIR/run-command $RUN_COMMAND