#!/bin/sh ## author: Parv, ## date: nov. 14 2002 ## ## license: free to use as you please w/ proper credit given ## ## name: xinitrc ## ## purpose: to launch various, mostly X, programs w/ multitide of ## options and sequence ## ## usage: ## see man pages: X(7), startx(1), xinit(1) ## # this script takes first argument, if any, as the wm to run. # nothing happens to any other positional parameters. # # warning: this scipts starts wm in background and a regular xterm in # foreground. so if type "exit" in xterm, your X session will end. TERM=xterm-color export TERM # rc files' collection CF=${HOME}/cf/x # set default wm; if one given, overrides the default WM=fvwm2 case $# in 1) WM=$1 shift ;; esac # x11 bin home XBIN=/usr/X11R6/bin My_Xterm=${HOME}/extern/bin/xterm ## set miscellaneous things # #xset r rate 350 30 b 70 300 90 xset b 70 300 90 xmodmap ~/.xmodmap-`uname -n` & xrdb -merge ${HOME}/.Xresources & cd ## used too may times, so just create a function # read_file () { [ -r "$1" ] && [ -f "$1" -o -L "$1" ] return $? } # background graphic & color BG_graphic=${HOME}/graphic/mine/xpm/circle-red-dark.xpm BG_colour=rgb:60/0/0 ## set background - graphic or solid colour # if read_file "$BG_graphic" && [ -x "${XBIN}/xv" ] then ${XBIN}/xv -root -rmode 9 -quit $BG_graphic & else [ -x "${XBIN}/xsetroot" ] && \ ${XBIN}/xsetroot -solid ${BG_colour:-rgb:60/0/0} & fi #set -x -v ## start the first executeable command from a list # run_prog() { [ $# -eq 0 ] && echo ' run_prog: no argument given' 1>&2 && return 0 local prog prop for prog in $@ do [ -x "${XBIN}/${prog}" ] || continue # given a command, set properties/options case $prog in root*tail) prop="-geometry 80x36+0+149 log/misc/x.log,grey75" ;; # clipboards, cut buffers xcb) prop="-geometry 195x285-0+0 -n 8 -l v" ;; xclipboard) prop="-geometry 415x144+345-1 -bg rgb:30/30/30 -fg grey75" ;; xpostit*) prop="-geometry 24x64+154-0 -bg grey37 -fg white -sv -sb" ;; # load meters xperfmon*) prop="-geometry 190x140+90-20 -bg grey45 -fg black -bd grey45 -borderwidth 1 -interval 4 -immediate +sysload +usercpu +freeswap +diskxfr +inputpkts +outputpkts >/dev/null 2>&1" ;; xsysinfo*) prop="-geometry 190x80+90-20 -interval 3 -nonfs" ;; xload*) prop="-nolabel -geometry 190x80+90-20 -bg black -fg rgb:25/25/25 -hl rgb:60/0/0" ;; # clocks rclock) prop="-update 2 -geometry 80x80+0-0 -bg black -fg grey65" ;; xclock) # Color options seem useless, except reverse video (reverse), # in XFree86 4.3.0 prop="-analog -update 2 -geometry 80x80+0-0 -foreground black -hd black -hl black -reverse" ;; # tail pipe *tail*pipe*) ;; # everything else *) echo "properties not set for $prog" 1>&2 prop="" esac # if a command is executable, execute it w/ $prop & return eval exec ${XBIN}/${prog} ${prop} & break done } ## run wmmixer; withdrawn if run in blackbox/window maker # run_mixer () { local prop prop=" -s -position +83+706 -b black -l darkgoldenrod" if [ -x "${XBIN}/wmmixer" ] then sleep 1 case $1 in withdrawn) ${XBIN}/wmmixer -w ${prop} & ;; *) ${XBIN}/wmmixer ${prop} & ;; esac fi } ## find which/if any xvt is available which_xvt() { [ -x "$My_Xterm" ] case $? in 0 ) XVT="$My_Xterm" ;; * ) for XVT in xterm aterm rxvt NADA do if [ -x "${XBIN}/${XVT}" ] then XVT="${XBIN}/${XVT}" break fi [ "$XVT" = "NADA" ] && echo '# no xvt found...' 1>&2 done ;; esac } which_xvt XVT_Font='-fn -misc-fixed-medium-r-normal--13-*-*-*-c-70-iso8859-1' ## start wm # run_wm () { # $1: command, $2: alternate config file option flag, $3: alternate config file name if [ -x "$1" ] then [ "x$2" != "x" ] && read_file "$3" && exec $1 $2 $3 & [ "x$2" = "x" ] && exec $1 & elif [ -x "${XBIN}/twm" ] then exec ${XBIN}/twm & fi } # launch various programs at various intervals in background { # if a working xvt found... case "$XVT" in NADA) ;; *) # tail X applications log (see xf command) sleep 1 && \ exec "$XVT" -fg grey55 -bg black -geometry 80x24+0-290 -tn xterm \ -title tail-x-log \ $XVT_Font \ -iconic -e tail -F +1 ${HOME}/log/misc/x.log & # tail mail log sleep 1 && \ exec "$XVT" -fg grey55 -bg black -geometry 81x46+0-80 -tn xterm \ $XVT_Font \ -iconic -e ${HOME}/bin/tail-chk-procmail & # man page shell sleep 1 && \ exec "$XVT" -fg grey55 -bg black -geometry 100x28-0-290 -tn xterm \ -iconic -e ${HOME}/bin/showman & ;; esac #run_prog root-tail # clock sleep 1 run_prog rclock xclock # clipboard, cut buffer #sleep 1 #run_prog xcb #run_prog xclipboard 'xpostit+' xpostit [ -p "$HOME/log/pipe" ] \ && { sleep 3 exec "$XVT" -fg grey55 -bg black -geometry 95x45-5+105 \ -title tail-pipe \ $XVT_Font \ -iconic \ -e tail -F "$HOME/log/pipe" & } } & case $WM in tvtwm) run_mixer notwithdrawn & #{ sleep 6 && run_prog 'xperfmon++' xload; } & { sleep 6 && run_prog xsysinfo xload; } & run_wm ${XBIN}/tvtwm -f ${CF}/tvtwm.cf ;; *|fvwm2) #run_mixer notwithdrawn & #{ sleep 6 && run_prog 'xperfmon++' xload; } & { sleep 6 && run_prog xsysinfo xload; } & run_wm ${XBIN}/fvwm -f ${HOME}/cf/fvwm/fvwm.cf #run_wm ${XBIN}/fvwm -f ${HOME}/cf/fvwm/fvwm.test ;; esac #sleep 50 && nice -n 15 mozilla & ## run "xconsole" # case "$XVT" in *aterm | *rxvt) exec ${XVT} +tr \ -C -name XConsole -geometry 143x10+0+0 \ $XVT_Font \ -bg black -fg grey75 & sleep 1 exec ${XVT} -title '(x control)' -geometry 105x29+0+143 \ -iconic break ;; *xterm) exec ${XVT} -C -name XConsole -geometry 143x10+0+0 \ $XVT_Font \ -bg black -fg grey75 & sleep 1 exec ${XVT} -T '(x control)' -geometry 105x29+0+143 \ -iconic break ;; *) sleep 1 [ -x ${XBIN}/xconsole ] && \ exec ${XBIN}/xconsole -notify -exitOnFail -geometry 132x10+1+1 \ $XVT_Font \ -bg black -fg white break ;; esac # tvtwm pl11 # - root window color set bt xsetroot remains "underneath" the # VirtualDesktopBackground color if specified (black/white stipple # pattern otherwise) # # fvwm 2.5.4 : # + superlative key binding support # - damn too many modules # - StippledTitleOff has no effect on Sticky windows # - FPLeaveToUnfocus doesn't have any effect when used after ClickToFocus # # - torn menu windows are not worth having as mouse needs to be elsewhere # for an menu selection to happen; click alone doesn't cut it # # - FPClickToFocus & FPClickDecorToFocus don't seem to do anything, # unlike ClickToFocus # # - Fvwm(WinList|IconMgr), when shaded, doesn't add new windows to its list # see: http://www.hpc.uh.edu/fvwm/archive/0211/msg00534.html # # - inconsistency in between man page & the binary: # "strings /usr/X11R6/bin/fvwm | grep -i MaxLabel" # produces "MaxLabelWidth" # "man fvwm | col -b | grep -i MaxLabel" # produces "MaxLabelLength" # # - a bug in x_pager.c , caused the pager to consume 100% CPU # which was fixed around nov. 1 2002 (in cvs) # for details, see: http://www.hpc.uh.edu/fvwm/archive/0211/msg00000.html # # - OverrideGrabFocus generates error message: # # [FVWM][CMD_Style]: <> Bad style option: OverideGrabFocus # # blackbox 0.61.1 # - needs bbpager for paging and bbkeys for key bindings, externally # - can't restart another wm w/ a config file # # vtwm 5.4.5a # + can restart other wm w/ a config file # - sometimes window remains "stuck" after moving # - sometimes crashes on restart, or w/ gtv or when changing # desktop from keyboard # - no (known) way(s) to bind key(s) to root menu # # ude 0.2.7b.1 # - menus don't remain stationary # - window title covers the inside area of the window # - there doesn't seem to any default window move button in pie menu # or a item in root menu # # wmx 5.6 # - exit is troublesome w/ 2 button mouse # # olvwm 4.2 # - no default menu; thus no "exit" # # sapphire 0.15.6 # - crashes on restart # - can't be restarted from another wm