Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ~/.xinitrc: Executed by Slim/LXDM login manager to startx X session.
- # You can use F1 with Slim to change your window manager or configure
- # it permanently with your personal applications.conf file.
- #
- eval_safe_quote() # $@
- # Use this shell's 'set' command to consistently quote values with exterior
- # Single Quotes (SQ). The SQ character itself is quoted differently according
- # to each shell. This implementation is for dash and ash, which quote SQ as
- # "'" and ''"'", respectively.
- {
- local a stop="$(od -An -N4 -i /dev/urandom)"
- for a; do a="${a}
- $stop"; set; done | awk -v Q="'" '# awk, gawk, mawk
- f!=1 && /^a=/ { printf "%s", substr($0,3); f=1; next }
- f==1 && !/^'"$stop"'/ { printf "\n%s", $0; next }
- f==1 && /^'"$stop"'/ { printf Q" "; f=0; next }
- '
- }
- CURDIR=$PWD
- export USER=${1:-"tux"}
- export GROUP=${2:-`su -c 'id -gn' tux`}
- export HOME=`eval 'echo ~'"$USER"`
- Xorg &
- unset XDG_CONFIG_HOME
- unset XDG_DATA_HOME
- unset XDG_CACHE_HOME
- XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
- if [ -f "$XDG_CONFIG_HOME"/slitaz/applications.conf ]; then
- apps_conf="$XDG_CONFIG_HOME"/slitaz/applications.conf
- elif [ -f "/etc/skel/.config/slitaz/applications.conf" ]; then
- apps_conf="/etc/skel/.config/slitaz/applications.conf"
- elif [ -f "/etc/slitaz/applications.conf" ]; then
- apps_conf="/etc/slitaz/applications.conf"
- fi
- . "$apps_conf"
- #[ "$desktop" = "" ] && [ -f /etc/desktop_app ] && read -r desktop < /etc/desktop_app
- [ "$desktop" = "" ] && desktop=pcmanfm
- #tazbox mkmenu
- #[ -f /tmp/wmexitmode.txt ] && rm /tmp/wmexitmode.txt
- #[ "$1" ] && WINDOW_MANAGER="$1"
- . /etc/rc.d/PUPSTATE
- #v4.01 BK daemon to handle kernel uevents...
- echo '' > /var/local/pup_event_icon_change_flag
- /sbin/clean_desk_icons #v4.02 tidy up drive icons first.
- #/sbin/pup_event_frontend_d &
- #130525 ...start this further down.
- #w482 reshape background image if widescreen...
- #120708 need to reshape for PUPMODE=2 also...
- #[ $PUPMODE -eq 5 ] && /usr/sbin/background_reshape
- NEEDRESHAPE='yes'
- [ -f /usr/share/backgrounds_original/ORIGINAL-default.jpg ] && NEEDRESHAPE='no'
- [ -f /usr/share/backgrounds_original/ORIGINAL-default.png ] && NEEDRESHAPE='no'
- [ "$NEEDRESHAPE" = "yes" ] && /usr/sbin/background_reshape
- userresources=$HOME/.Xresources
- usermodmap=$HOME/.Xmodmap
- sysresources=/usr/lib/X11/xinit/Xresources
- sysmodmap=/usr/lib/X11/xinit/.Xmodmap
- # merge in defaults and keymaps
- if [ -f $sysresources ]; then
- xrdb -merge -nocpp $sysresources
- fi
- if [ -f $sysmodmap ]; then
- xmodmap $sysmodmap
- fi
- if [ -f $userresources ]; then
- xrdb -merge -nocpp $userresources
- fi
- if [ -f $usermodmap ]; then
- xmodmap $usermodmap
- fi
- CURRENTWM="`cat /etc/windowmanager`"
- #100501 if full nvidia pkg installed, it has a gui config app...
- [ -f $HOME/.nvidia-settings-rc ] && nvidia-settings --load-config-only
- [ -f $HOME/.xgamma-gamma ] && /bin/sh $HOME/.xgamma-gamma #100215 see /usr/sbin/xgamma-gui.
- #0.9.8 sync selection-buffer and clipboard. only useful for older apps
- #such as rxvt that use the selection-buffer...
- [ -f /usr/bin/autocutsel ] && /usr/bin/autocutsel &
- #...disadvantage of this is it creates a little square bottom-right of screen.
- if [ -e /tmp/videomode ];then #xvesa only: testing a video mode
- video-wizard &
- fi
- [ -f /usr/local/bin/agenda_chk ] && agenda_chk &
- #v1.0.7 set by xrandrshell, part of xorg wizard... v3.99...
- if [ -f /etc/xrandrindex ];then
- #v3.99 workround for dual monitors, 'head -n 1'....
- XRANDRDEFAULT="$(xrandr -q | grep '\*' | tr -s ' ' | grep '^ [0-9]' | cut -f 2,3 -d ' ' | cut -f 1 -d '*' | tr ' ' '@' | head -n 1)" #130202 return 1024x768@60.0
- XRANDRINDEX="`cat /etc/xrandrindex`" #v3.99 XRANDRINDEX now is XxY resolution. #130202 now vertxhoriz@freq (refer quicksetup).
- #but do not switch if default is already this resolution....
- if [ "$XRANDRINDEX" = "$XRANDRDEFAULT" ];then
- rm -f /etc/xrandrindex
- else
- echo "$XRANDRINDEX"|grep -q "@"
- case $? in
- 1)NEW_XY="$XRANDRINDEX"
- xrandr -s $NEW_XY #131124 (see quicksetup)
- ;;
- *)NEW_XY="$(echo -n "$XRANDRINDEX" | cut -f 1 -d '@')" #130202
- NEW_VFREQ="$(echo -n "$XRANDRINDEX" | cut -f 2 -d '@')" #130202
- xrandr -s $NEW_XY -r $NEW_VFREQ #130202
- ;;
- esac
- fi
- fi
- if [ -f $HOME/.xset.sh ];then
- #this is created by /usr/bin/pupx...
- eval "$HOME/.xset.sh"
- else
- ##Xorg has it's own fontpath settings in /etc/X11/xorg.conf...
- #if [ "`readlink /usr/bin/X`" != "Xorg" ];then
- # #xset fp+ /usr/lib/X11/fonts/Type1/
- # #xset fp+ /usr/lib/X11/fonts/TTF/
- # xset fp+ /usr/share/fonts/default/Type1/
- # xset fp+ /usr/share/fonts/default/TTF/
- #fi
- xset s 600 600 s blank
- fi
- #v1.0.7 also see /etc/rc.d/rc.local0
- if [ -f $HOME/.fonts/fonts.dir ];then
- xset fp+ $HOME/.fonts/
- fi
- [ -f /usr/bin/xsetroot ] && xsetroot -cursor_name top_left_arrow
- case "$WINDOW_MANAGER" in
- lxde*) ;;
- *)
- case $desktop in
- pcmanfm) pcmanfm --desktop & ;;
- rox)
- #relocates right-side icons to actual right-side of screen...
- /usr/sbin/fixPuppyPin $HOME/ROX-Filer/PuppyPin #v1.0.7
- sleep 1 # let the dust settle
- if [ -f $HOME/Choices/ROX-Filer/PuppyPan1 ];then
- roxfiler -p $HOME/Choices/ROX-Filer/PuppyPin -r $HOME/Choices/ROX-Filer/PuppyPan1
- else
- roxfiler -p $HOME/Choices/ROX-Filer/PuppyPin
- fi
- ;;
- esac
- ;;
- esac
- /sbin/pup_event_frontend_d & #130525 moved down.
- #v2.0.0
- /usr/sbin/delayedrun &
- ##v2.01 hide cursor when not moving... (setup in /usr/sbin/input-wizard)
- #if [ -f /etc/mousehide ];then
- # IDLETIME="`cat /etc/mousehide | cut -f 1 -d ','`"
- # [ ! "$IDLETIME" = "0" ] && unclutter -idle $IDLETIME &
- #fi
- if [ -z "$XDG_CONFIG_HOME" ]; then
- export XDG_CONFIG_HOME="$HOME/.config"
- fi
- if [ -z "$XDG_DATA_HOME" ]; then
- export XDG_DATA_HOME="$HOME/.local/share"
- fi
- export XDG_CACHE_HOME=$HOME/.cache
- [ -z "$XAUTHORITY" ] && XAUTHORITY=/root/.Xauthority
- [ -e "$XAUTHORITY" ] && cp --remove-destination -f $XAUTHORITY $HOME/.Xauthority &&
- chown $USER:$GROUP $HOME/.Xauthority &&
- export XAUTHORITY=$SPOT_HOME/.Xauthority
- #if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
- # if test -z "$XDG_RUNTIME_DIR" -o ! -S "$XDG_RUNTIME_DIR/bus" -o ! -O "$XDG_RUNTIME_DIR/bus"; then
- # eval "$(dbus-launch --sh-syntax --exit-with-session)"
- # fi
- # fi
- # Ensure the existance of openbox config file
- OPENBOX_CONF_DIR="$XDG_CONFIG_HOME/openbox"
- if [ ! -f "$OPENBOX_CONF_DIR/lxde-rc.xml" ]; then
- mkdir -p "$OPENBOX_CONF_DIR"
- cp /etc/xdg/openbox/LXDE/rc.xml "$OPENBOX_CONF_DIR/lxde-rc.xml"
- fi
- # Ensure the existance of the 'Desktop' folder
- if [ -e "$XDG_CONFIG_HOME/user-dirs.dirs" ]; then
- . "$XDG_CONFIG_HOME/user-dirs.dirs"
- else
- XDG_DESKTOP_DIR="$HOME/Desktop"
- fi
- mkdir -p "$XDG_DESKTOP_DIR"
- # Ensure the existance of the user applications folder
- USER_APPS_DIR="$XDG_DATA_HOME/applications"
- mkdir -p "$USER_APPS_DIR"
- export XDG_DATA_DIRS="/usr/share:/usr/local/share:$HOME/.local/share"
- # Clean up after GDM (GDM sets the number of desktops to one)
- xprop -root -remove _NET_NUMBER_OF_DESKTOPS -remove _NET_DESKTOP_NAMES -remove _NET_CURRENT_DESKTOP 2> /dev/null
- # Enable GTK+2 integration for OpenOffice.org, if available.
- export SAL_USE_VCLPLUGIN=gtk
- if [[ "$WINDOW_MANAGER" = lxde* ]]; then
- if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
- if test -z "$XDG_RUNTIME_DIR" -o ! -S "$XDG_RUNTIME_DIR/bus" -o ! -O "$XDG_RUNTIME_DIR/bus"; then
- eval "$(dbus-launch --sh-syntax --exit-with-session)"
- fi
- fi
- export XDG_MENU_PREFIX="lxde-"
- export XDG_CURRENT_DESKTOP="LXDE"
- # Start the LXDE session
- #exec su --group=$GROUP -c '/usr/bin/lxsession -s LXDE -e LXDE' - $USER
- exec su $USER -p -c '/usr/bin/lxsession -s LXDE -e LXDE'
- #exec /usr/bin/lxsession -s LXDE -e LXDE
- else
- #EXEC="exec ck-launch-session dbus-launch --sh-syntax --exit-with-session"
- #EXEC="exec su --group=$GROUP -c 'dbus-launch --sh-syntax --exit-with-session'"
- EXEC="exec su -p -c 'dbus-launch --sh-syntax --exit-with-session'"
- LOG="/dev/null" ; X=$LOG ; ERR=$X
- #vboxadd start
- #VBoxClient --clipboard
- case "$WINDOW_MANAGER" in
- openbox|lxde*|icewm*|xfce4|compiz|karmen|dwm|fluxbox*|razor*|mate*)
- $EXEC ${WINDOW_MANAGER%-session}-session - $USER ;;
- enlightenment)
- $EXEC enlightenment_start - $USER;;
- kde) $EXEC startkde ;;
- lxqt) $EXEC startlxqt ;;
- *) $EXEC $WINDOW_MANAGER - $USER;
- esac #2>>$ERR >>$X
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement