All pastes #738453 Raw Edit

.xintrc

public text v1 · immutable
·published 2007-10-16 10:11 UTC
rendered paste body
# .xinitrc

# Common stuff to start with every WM
# Tue Jun  5 19:16:35 CEST 2007

# Determine the resolution and call feh on that basis
BACKFILE="${HOME}/.backgrounds"
set_background() {
	RES=`xdpyinfo | grep dimensions  | cut -c 18-26`
	IMAGE=`grep $RES $BACKFILE | cut -d ':' -f 2`
	FLAGS=`grep $RES $BACKFILE | cut -d ':' -f 3`
	eval "feh $FLAGS $IMAGE"
}

start_gnome-settings() {
	# load this to have gtk2 apps look ok
	# This approach uses awk to determine when gnome-settings is up
	# and only then proceed with the script.
	/usr/libexec/gnome-settings-daemon &
	GSDPID=$!
	while /usr/sbin/lsof -u$USER | awk 'BEGIN { found = 0; }
	($2 == "'$GSDPID'") && ($8 ~ /orbit-'$USER'/) { found = 1; next }
	END { exit found }'
	do
		sleep 1
	done
}

# Fluxbox
# Tue Jun  5 12:56:05 CEST 2007
start_fluxbox() {
	export LANGUAGE=bg_BG.UTF-8
	export LANG=bg_BG.UTF-8
	fbsetbg -C ~/.fluxbox/fb-button-black.png
	start_gnome-settings
	xscreensaver &
	xcompmgr -n &
	conky &
	/usr/bin/fluxbox &
	# And let the TODO-list be what the session is all about.
	# That's active anti-procrastination ;)
	exec urxvt -T TODO -g 80x50 -e "/bin/sh" -c "vi ~/TODO"
}

# dwm
start_dwm() {
	export LANGUAGE=en_US.UTF-8
	set_background
	set_background_image
	eval "feh $FLAGS $IMAGE"
	urxvtd -q -o -f&
	rm -f ~/.Xdefaults
	ln -s ~/.Xdefaults.pseudo ~/.Xdefaults
	while true; do echo `date +'%a %m.%d(%V) %H:%M.%S'` '|' `uptime | sed 's/.*up/ up:/;s/,.*users.*:/ |/;s/,//g'` ; sleep 1; done | dwm&
		exec urxvt -T TODO -g 77 -e "/bin/sh" -c "vi ~/TODO"
}

# Experimental Compiz. It sucks.
start_compiz() {
	gnome-window-decorator&
	compiz --use-cow gconf&
	set_background
	rm -f ~/.Xdefaults
	ln -s ~/.Xdefaults.composite ~/.Xdefaults
	urxvt &
	cairo-clock &
	exec urxvt -T TODO -g 77 -e "/bin/sh" -c "vi ~/TODO"
}

# wmii
start_wmii() {
	export LANGUAGE=bg_BG.UTF-8
	export LANG=bg_BG.UTF-8
	urxvtd -q -o -f&
	rm -f ~/.Xdefaults
	ln -s ~/.Xdefaults.pseudo ~/.Xdefaults
	set_background
	set_background_image
	eval "feh $FLAGS $IMAGE"
	wmii &
	exec urxvt -T TODO -g 77 -e "/bin/sh" -c "vi ~/TODO"
}

# enlightenment 16
start_e16() {
	# E doesn't handle Unicode too well, so no Bulgarian
	rm -f ~/.Xdefaults
	ln -s ~/.Xdefaults.composite ~/.Xdefaults
	urxvtd -o -f -q &
	exec e16
}

start_ion3() {
	urxvtd -o -f -q &
	rm -f ~/.Xdefaults
	ln -s ~/.Xdefaults.pseudo ~/.Xdefaults
	set_background
	exec /usr/local/bin/ion3
}

start_gnome() {
	exec gnome-session
}
start_xmonad() {
	urxvtd -o -f -q &
	rm -f ~/.Xdefaults
	ln -s ~/.Xdefaults.pseudo ~/.Xdefaults
	set_background
	HEIGHT=$((${RES:5} - 15))
	while true; do echo `date +'%a %m.%d(%V) %H:%M.%S'` '|' \
		`uptime | sed 's/.*up/ up:/;s/,.*users.*:/ |/;s/,//g'` ;\
		sleep 1; 
	done | dzen2 -xs 1 -y $HEIGHT -bg $COLOR_BG -fg $COLOR_FG\
	-fn -misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1 \
	-ta r -w 1000 -x 400&
	export XTERMCMD="urxvtc"
	urxvtc -T TODO -e "/bin/zsh" -c "vi ~/TODO"
	gcpubar -o -bg $COLOR_BG -fg $COLOR_FG | dzen2 -w 200 -xs 1 -y $HEIGHT \
	-x 200 -bg $COLOR_BG  -fg $COLOR_FG -ta l\
	-fn -misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1 &
	# get around weird cursor issue with XMonad
	xsetroot -cursor_name left_ptr
	exec ssh-agent xmonad | dzen2 -w 200 -x 0\
	-fn -misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1 \
	-xs 1 -y $HEIGHT -bg $COLOR_BG -fg $COLOR_FG -ta l
}

fetchmail -m "/usr/bin/procmail -d %T"
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
COLOR_BG="#001010"
COLOR_FG="#618181"
export PATH="$HOME/bin:${PATH}"

# Based on Command line options to this script, choose which WM to start.
# Start default wm if no args are given, twm if any unrecognized argument was
# given
if [ $1 ] ; then 
	case $1 in
		xmonad)
		start_xmonad
		;;
		dwm)
		start_dwm
		;;
		compiz)
		start_compiz
		;;
		fluxbox)
		start_fluxbox
		;;
		e16)
		start_e16
		;;
		xfce4)
		exec startxfce4
		;;
		ion3)
		start_ion3
		;;
		icewm)
		icewmbg &
		icewmtray &
		exec icewm
		;;
		wmaker)
		exec wmaker
		;;
		blackbox)
		exec blackbox
		;;
		wmii)
		start_wmii
		;;
		gnome)
		start_gnome;;
		*)
		echo ".xinitrc: unknown session $1, choosing twm" >> ~/.slim.log
		exec twm
		;;
	esac
else
	start_xmonad
fi