diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-07-11 13:41:06 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-07-11 13:41:06 (GMT) |
commit | 0bfd4e963462bd70e78ae8e2e45e766d8eb4c387 (patch) | |
tree | 93db9182f091b4782651d54eb3dc8050f4ee403e /scripts/xinitrc | |
parent | e899d60349e6697f5d3fd077c114753f97d488f1 (diff) |
If we are running under a profile generate a new random one
It is saved in the config so that next time it will use the same
Diffstat (limited to 'scripts/xinitrc')
-rw-r--r-- | scripts/xinitrc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/xinitrc b/scripts/xinitrc index fd85440..ea1ae23 100644 --- a/scripts/xinitrc +++ b/scripts/xinitrc @@ -7,10 +7,20 @@ unset SESSION_MANAGER SCRIPTS_DIR=`dirname "$0"` ROOT_DIR=`dirname "$SCRIPTS_DIR"` -if [ -f $ROOT_DIR/config ]; then - source $ROOT_DIR/config +if [ ! -f $ROOT_DIR/config ]; then + touch $ROOT_DIR/config fi +if [ ! -z $SUGAR_PROFILE ]; then + grep -q PROFILE $ROOT_DIR/config + if [ $? -eq 1 ]; then + randomstring=`</dev/urandom tr -cd A-Za-z0-9 | head -c10` + echo "PROFILE=$randomstring" >> $ROOT_DIR/config + fi +fi + +source $ROOT_DIR/config + # 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. |