gnome-session/gnome

78 lines
2.7 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#
# This is not the original gnome-session but a start script
# to install some preconfiguration for GNOME2
# and some variables to check.
#
# For feedback on this script please use
# https://bugzilla.novell.com/
#
# Set STYLE variable for other applications (e. g. xmms).
STYLE="$(gconftool-2 --get /desktop/gnome/interface/gtk_theme 2>/dev/null)"
export STYLE="${STYLE:-Default}"
# If user still uses default wallpaper, update it:
OLD_WALLPAPER=$(gconftool-2 --get /desktop/gnome/background/picture_filename 2>/dev/null)
if [ -z "$OLD_WALLPAPER" -o\
"$OLD_WALLPAPER" != "${OLD_WALLPAPER#/usr/share/wallpapers/default}" ] ; then
DIMENSIONS=$(xdpyinfo | sed -n 's/^ *dimensions: *\([^ ]*\) .*$/\1/p')
X=${DIMENSIONS%x*}
Y=${DIMENSIONS#*x}
# Select normal or wide angle wallpaper:
GNOME_WALLPAPER="default-1600x1200.jpg"
[ $((($X * 10) / $Y)) -ge 15 ] && GNOME_WALLPAPER="default-1920x1200.jpg"
GNOME_WALLPAPER="/usr/share/wallpapers/"$GNOME_WALLPAPER
if [ -e "$GNOME_WALLPAPER" -a "$GNOME_WALLPAPER" != "$OLD_WALLPAPER" ] ; then
gconftool-2 -s /desktop/gnome/background/picture_filename --type string $GNOME_WALLPAPER
gconftool-2 -s /desktop/gnome/background/picture_options --type string stretched
fi
fi
function use_sled10_default {
# do this only for SLED 10
([ -e /etc/SuSE-release ] && grep "SUSE Linux Enterprise Desktop 11" /etc/SuSE-release) || return
# do this only one time
[ -e $HOME/.skel/sled10-run ] && return
# dump the existing config for backup
PANEL_BACKUP=panel-settings-backup-`date '+%m%d%y%H%M%S'`.xml
gconftool-2 --dump /apps/panel > $PANEL_BACKUP
# unset the current panel configuration
gconftool-2 --recursive-unset /apps/panel/default_setup
gconftool-2 --unset /apps/panel/general/toplevel_id_list
gconftool-2 --unset /apps/panel/general/applet_id_list
gconftool-2 --unset /apps/panel/general/object_id_list
gconftool-2 --recursive-unset /apps/panel/profiles/default
gconftool-2 --recursive-unset /apps/panel/toplevels
gconftool-2 --unset /apps/metacity/general/num_workspaces
# we are done, set the flag
touch ~/.skel/sled10-run
}
# start up the gnome2 session
# reset the SLED 10 UI only if upgrading from NLD9/SLES9, anything newer we
# ignore (like SL 9.3), the logic here is redundant but its low risk
# Remove this code after SLED11:
mkdir -p $HOME/.skel
TRY_SLED10=1
if [ ! -e $HOME/.skel/gnome2-run ] || [ -e $HOME/.skel/gnome2-run-9.2 ] ; then
TRY_SLED10=0
fi
if [ $TRY_SLED10 -gt 0 ] ; then
use_sled11_default
else
touch ~/.skel/sled10-run
fi
# Uncomment after SLED12, remove after SLED14:
#rm -f ~/.skel/gnome2-run ~/.skel/gnome2-run-9.2 ~/.skel/sled10-run
exec /usr/bin/gnome-session