#!/bin/sh # ~/.xsession -> ~/public_html/dots # http://berklix.com/~jhs/dots/.xsession by Julian Stacey # See also /site/domain/this/usr/X11R6/lib/X11/xdm/Xsession # Sets up local X screen & keyboard & exports screen access permissions. # Run by xsm, called from xdm (xdm used to call it direct) # If absent, xsm accesses /usr/X11R6/lib/X11/xsm/system.xsm # man xsm also refers to ~/.xsmstartup. # Default FreeBSD-5.3 /usr/X11R6/lib/X11/xsm/system.xsm contains this: # twm # smproxy # xterm # Keep colours same in all of # /site/etc/system.fvwmrc # ~jhs/.Xdefaults.`hostname -s` # ~jhs/.xsession # ~jhs/public_html/bin/.csh/consolev # ~root/.Xdefaults # For Germans: setenv LANG de_DE.ISO8859-1 # Import standard X preferences. # xrdb -merge "~/.Xresources" xrdb -merge ~/.Xdefaults.common # Import host specific X preferences. if [ -r ~/.Xdefaults.`hostname -s` ]; then xrdb -merge ~/.Xdefaults.`hostname -s` fi # Import host & screen specific X preferences. if [ -r ~/.Xdefaults.`printenv DISPLAY` ]; then # Arrange colours/monochrome xrdb -merge ~/.Xdefaults.`printenv DISPLAY` fi # Session Manager Proxy smproxy & # laps.no.net reports: unable to connect to sesson manager # Determine screen size dynamically. # Much better to do it dynamically as if EG a laptop is reconfigured # to come up after login in reduced pixel dimensions, eg to drive a projector, # then this dynamic case statement will still work, whereas anything based # just on our static knowledge of host physical maximal sizes could fail. # Also dynamic gives future proofing against future hardware. screen=`xdpyinfo | grep dimensions | awk '{printf "%s\n",$2}'` case $screen in # { 1600x1200) #( { flip|fire|laps # UXGA HEIGHT="57" # keep this same as in ~jhs/bin/.csh/consolev bifg="50x50+927-0" dsl="20x3+122-0" ;; # } 1024x768) #( { lapd|lapa|lapc HEIGHT="36" bifg="40x40+570-0" dsl="20x3+122-0" ;; # } 640x480) #( { lapl|lapl-p HEIGHT="23" bifg="30x30+570-0" dsl="20x3+122-0" ;; # } default) #( { HEIGHT="36" bifg="50x50+570-0" dsl="20x3+122-0" ;; # } esac # } JSDOM="js.berklix.net" case `hostname` in # { fire.$JSDOM|\ lapa.$JSDOM|\ lapc.$JSDOM|\ lapd.$JSDOM|\ lapl-p.$JSDOM|\ lapl.$JSDOM|\ lapn.$JSDOM|\ laps.$JSDOM\ ) # ( { xterm -sb -sl 1024 -n dual -T "Dual rlogin" \ -g 80x3+0+`echo "0 $HEIGHT * p" | dc` \ -bg seashell2 -e rlogin -D dual & xterm -sb -sl 1024 -n film -T "Film rlogin" \ -g 80x3+0+`echo "1 $HEIGHT * p" | dc` \ -bg DarkSlateGray1 -e rlogin -D film & xterm -sb -sl 1024 -n fire -T "Fire rlogin" \ -g 80x3+0+`echo "2 $HEIGHT * p" | dc` \ -bg LightGoldenRodYellow -e rlogin -D fire & xterm -sb -sl 1024 -n flip -T "Flip rlogin" \ -g 80x3+0+`echo "3 $HEIGHT * p" | dc` \ -bg moccasin -e rlogin -D flip & xterm -sb -sl 1024 -n king -T "King rlogin" \ -g 80x3+0+`echo "4 $HEIGHT * p" | dc` \ -bg DarkSeaGreen1 -e rlogin -D king & xterm -sb -sl 1024 -n lapa -T "LapA rlogin" \ -g 80x3+0+`echo "5 $HEIGHT * p" | dc` \ -bg yellow -e rlogin -D lapa & xterm -sb -sl 1024 -n lapc -T "LapC rlogin" \ -g 80x3+0+`echo "6 $HEIGHT * p" | dc` \ -bg plum2 -e rlogin -D lapc & xterm -sb -sl 1024 -n lapd -T "LapD rlogin" \ -g 80x3+0+`echo "7 $HEIGHT * p" | dc` \ -bg khaki -e rlogin -D lapd & xterm -sb -sl 1024 -n lapl -T "LapL rlogin" \ -g 80x3+0+`echo "8 $HEIGHT * p" | dc` \ -bg OliveDrab1 -e rlogin -D lapl & xterm -sb -sl 1024 -n lapn -T "lapN rlogin" \ -g 80x3+0+`echo "9 $HEIGHT * p" | dc` \ -bg burlywood1 -e rlogin -D lapn & xterm -sb -sl 1024 -n laps -T "LapS rlogin" \ -g 80x3+0+`echo "10 $HEIGHT * p" | dc` \ -bg PowderBlue -e rlogin -D laps & xterm -sb -sl 1024 -n loft -T "Loft rlogin" \ -g 80x3+0+`echo "11 $HEIGHT * p" | dc` \ -bg PaleGoldenRod -e rlogin -D loft & xterm -sb -sl 1024 -n mart -T "Mart rlogin" \ -g 80x3+0+`echo "12 $HEIGHT * p" | dc` \ -bg aquamarine -e rlogin -D mart & xterm -sb -sl 1024 -n mini -T "Mini rlogin" \ -g 80x3+0+`echo "13 $HEIGHT * p" | dc` \ -bg YellowGreen -e rlogin -D mini & xterm -sb -sl 1024 -n park -T "Park rlogin" \ -g 80x3+0+`echo "14 $HEIGHT * p" | dc` \ -bg AliceBlue -e rlogin -D park & xterm -sb -sl 1024 -n rain -T "Rain rlogin" \ -g 80x3+0+`echo "15 $HEIGHT * p" | dc` \ -bg pink -e rlogin -D rain & xterm -sb -sl 1024 -n scan -T "Scan rlogin" \ -g 80x3+0+`echo "16 $HEIGHT * p" | dc` \ -bg darkgoldenrod1 -e rlogin -D scan & xterm -sb -sl 1024 -n thin -T "Thin rlogin" \ -g 80x3+0+`echo "17 $HEIGHT * p" | dc` \ -bg cyan -e rlogin -D thin & xterm -sb -sl 1024 -n snow -T "Snow rlogin" \ -g 80x3+0+`echo "18 $HEIGHT * p" | dc` \ -bg peru -e rlogin -D snow & xterm -sb -sl 1024 -n wind -T "Wind rlogin" \ -g 80x3+0+`echo "19 $HEIGHT * p" | dc` \ -bg lightcyan1 -e rlogin -D wind & #--- Host Test last as often does not exist. xterm -sb -sl 1024 -n snow -T "Test rlogin" \ -g 80x3+0+`echo "20 $HEIGHT * p" | dc` \ -bg burlywood -e rlogin -D test & # Host Deli not listed xterm -geometry $dsl -e ~/bin/.csh/dsl & # xterm -sb -sl 1024 -n local -T "Local" -g 80x3+0+0 & ;; # } dual.$JSDOM|\ film.$JSDOM|\ flip.$JSDOM|\ king.$JSDOM|\ loft.$JSDOM|\ mini.$JSDOM|\ mini.$JSDOM|\ park.$JSDOM|\ rain.$JSDOM|\ test.$JSDOM|\ wind.$JSDOM\ ) #( { # Headless or switched monitor. xterm & ;; # } lapl.no.net) #( { xterm -sb -sl 1024 -n lapl -T "LapL rlogin" \ -g 80x24 -bg OliveDrab1 -fn 9x15bold & # large font to read in dark restaurants. ;; # } flat.berklix.org|\ thin.berklix.org|\ slim.berklix.org|\ tower.berklix.org|\ default) #( { # monochrome X terminal ? xterm -g 80x3-0 -fg black -bg white & ;; # } esac # } case `hostname` in # { fire.$JSDOM) # { Only 1 host to prevent multiple beeps. xbiff -g $bifg -file mail/.xbiff -volume 0 & # no (new) mail: horizontal lever, flag in middle, background # black (unless overridden by .Xdefaults.`hostname -s` # mail pending: vertical lever, flag at top, background: # white (unless overridden by .Xdefaults.`hostname -s` # xbiff old stuff from Michael Elbel @ PCS # MBOX=$(nice nslookup -query=mb ${USER}.aliases \ # | grep mail) # nice xrsh ${MBOX#*=} xbiff & ; unset MBOX # The -volume 0 makes no difference, # neither does "mixer 0" ;; # } default) #( { ;; # } esac # } # Map laptops to differing physical keyboards. case `hostname -s` in #{ lapa) #({ kbd # xmodmap ~/public_html/dots/.xmodmap/host=lapa.init # Internal: Black Keys, White letters, English. # External: White Keys, Black letters, American. # xmodmap ~/public_html/dots/.xmodmap/german ;; # } lapc) #({ ;; # } laps) #({ # English on internal keyboard, American or German external. # xmodmap /usr/X11R6/lib/X11/etc/xmodmap.std xmodmap ~/public_html/dots/.xmodmap/host=laps.init # Above to convert back to American in case last was German. ## xmodmap ~/public_html/dots/.xmodmap/english # see also xkeycaps ;; # } lapn) #({ xmodmap /usr/X11R6/lib/X11/etc/xmodmap.std # Internal: Black Keys, White letters, German xmodmap ~/public_html/dots/.xmodmap/german ;; # } lapl|lapl-p) #({ # English on internal keyboard. xmodmap ~/.xmodmaprc.english ;; # } default) #({ ;; #} esac # } # Export X Authorisation # printenv DISPLAY > tmp/xxa # lapl-p reports :0 bin/.sh/xauth.sh & # The "&" after xauth.sh is not strictly necessary, as for each # host, xauth.sh launches a seperate asynchronous process & then # exits, but as I have so many hosts, it takes too long waiting before # fvwm starts. # Start a bunch of root consoles to monitor hosts. hfull=`hostname` hshort=`hostname -s` domain=`echo $hfull | sed s/$hshort.//` if [ "$domain" = "bsn.com" ]; then # { hosts="flat.berklix.org tower.berklix.org cebulon gast" elif [ "$domain" = "berklix.org" ]; then # }{ hosts="thin flat tower" # slim elif [ "$domain" = "$JSDOM" ]; then # }{ hosts="deli " hosts="$hosts dual" hosts="$hosts film" hosts="$hosts fire" hosts="$hosts flat" hosts="$hosts flip" hosts="$hosts king" hosts="$hosts lapa" hosts="$hosts lapc" hosts="$hosts lapd" hosts="$hosts lapl" hosts="$hosts lapn" hosts="$hosts laps" hosts="$hosts loft" hosts="$hosts mart" hosts="$hosts mini" hosts="$hosts park" hosts="$hosts rain" hosts="$hosts scan" hosts="$hosts slim" hosts="$hosts snow" hosts="$hosts test" hosts="$hosts thin" hosts="$hosts tower" hosts="$hosts wind" elif [ "$domain" = "no.net" ]; then # }{ hosts="localhost" else # default }{ echo "No domain recognised by $0" hosts="" fi #} case `hostname -s` in #{ film|fire|flip|laps|dual|flat|king|loft|mini|park|rain|test|tower|wind) #({ DISPLAY=$hfull:0 export DISPLAY ;; #} lapa|lapc|lapd) #({ DISPLAY=$hfull:0 export DISPLAY #lapd.$JSDOM:0 ;; #} lapl|lapl-p) #({ # DISPLAY=`hostname -s`:0 # DISPLAY=$hfull:0 # echo "$DISPLAY" > tmp/xxd #lapl-p:0 from `hostname -s`:0 LOG OUT #lapl-p.$JSDOM:0 from `$hfull:0` LOG OUT # Maybe these LOGOUTS are from the PLIP interface ? # export DISPLAY ;; #} default) #({ ;; #} esac #} printenv DISPLAY > tmp/xxe case `hostname` in #{ dual.$JSDOM | \ film.$JSDOM | \ fire.$JSDOM | \ flat.$JSDOM | \ flip.$JSDOM | \ king.$JSDOM | \ lapa.$JSDOM | \ lapc.$JSDOM | \ lapd.$JSDOM | \ lapl.$JSDOM | \ lapn.$JSDOM | \ laps.$JSDOM | \ loft.$JSDOM | \ mart.$JSDOM | \ mini.$JSDOM | \ park.$JSDOM | \ rain.$JSDOM | \ scan.$JSDOM | \ slim.$JSDOM | \ snow.$JSDOM | \ test.$JSDOM | \ thin.$JSDOM | \ tower.$JSDOM | \ wind.$JSDOM \ ) #({ ie all host except lapl-p where this causes LOG OUT for i in $hosts ; do ( sleep 7 ; rsh -t 200 $i bin/.csh/consolev `printenv DISPLAY` \ $screen ) 2> /dev/null & # Sleep cos we want xauth to get run first, # but we dont want to sleep too long, cos probably want to # mouse click another screen. # Note the DISPLAY env. var does not make it across the rsh, # so it is passed as a visible parameter, else # if you start an xession on eg lapd or lapl, # all the consolev''s get started on default disp:0 or laps:0. done ;; #} esac #} gkrellm -g -0 & # Start a window manager. if [ -r /usr/X11R6/bin/fvwm ]; then fvwm # & elif [ -r /usr/local/bin/fvwm ]; then fvwm # & elif [ -r /usr/X11R6/bin/fvwm2 ]; then fvwm2 # & elif [ -r /usr/local/bin/fvwm2 ]; then fvwm2 # & elif [ -r /usr/X11R6/bin/flwm ]; then flwm # & elif [ -r /usr/local/bin/flwm ]; then flwm # & elif [ -r /usr/X11R6/bin/twm ]; then twm # & elif [ -r /usr/local/bin/twm ]; then twm # & else xterm # & # If your login host does not have your favourite (or any) # window manager, you could also call it from elsewhere: # rsh user fvwm -d $DISPLAY & # this 'user' is a host name fi # sleep 4 # sleep else the focus sometimes goes top left to open the xsm window, # before fvwm has finished filling in the fourth ("graphics") block of # its panel manager. # xsm