diff options
author | Julio Reyes <nemesiscodex@gmail.com> | 2013-07-05 14:13:11 (GMT) |
---|---|---|
committer | Julio Reyes <nemesiscodex@gmail.com> | 2013-07-05 14:13:11 (GMT) |
commit | b6db5b8af0af7ebfdd44cb53b09d63b819989338 (patch) | |
tree | ca439018bfa1c34c97bdaed4ec0f20bc36bd678f /bin/sugar.in |
Diffstat (limited to 'bin/sugar.in')
-rw-r--r-- | bin/sugar.in | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/bin/sugar.in b/bin/sugar.in new file mode 100644 index 0000000..12098db --- /dev/null +++ b/bin/sugar.in @@ -0,0 +1,82 @@ +#!/bin/sh + +if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then + echo Refusing to run as root. + exit 3 +fi + +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 +} + +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 + +# Set default profile dir +if test -z "$SUGAR_PROFILE"; then + export SUGAR_PROFILE=default +fi + +if test -z "$SUGAR_SCALING"; then + export SUGAR_SCALING=72 +fi + +export GTK2_RC_FILES="@prefix@/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc" + +# Needed for executing wpa_passphrase +export PATH="$PATH":/sbin:/usr/sbin + +if ! test -f "$GTK2_RC_FILES"; then + echo "sugar: ERROR: Gtk theme for scaling $SUGAR_SCALING not available in path $GTK2_RC_FILES" + exit 1 +fi + +# Set default language +export LANG="${LANG:-en_US.utf8}" +export LANGUAGE="${LANGUAGE:-${LANG}}" + +# Set Sugar's telepathy accounts directory +export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts + +# Workaround until gnome-keyring-daemon lets dbus activate it +# https://bugzilla.gnome.org/show_bug.cgi?id=628302 +if test "$SUGAR_EMULATOR" = "yes" -a "$(type gnome-keyring-daemon)"; then + gnome-keyring-daemon --components=secrets & +fi + +# Source language settings and debug definitions +if [ -f ~/.i18n ]; then + . ~/.i18n +fi +if [ -f ~/.sugar/debug ]; then + . ~/.sugar/debug +fi + +echo Xcursor.theme: sugar | xrdb -merge +metacity --no-force-fullscreen -d $DISPLAY & + +exec sugar-session |