#! /bin/bash xrdb -override $HOME/.Xdefaults : ${VNCSESSION=false} export __mdw_sechost="`hostname`" # --- Do some fiddling --- cleanup=":" xset b 10 2000 50 xset r rate 500 50 xset m 1 1 gnome-settings-daemon& mail-notification& $VNCSESSION || gkrellm& eval `xscsize -bx` # --- Crank up ESD --- if ! [ -r /tmp/.esd/socket ]; then esd -nobeeps -as 10& cleanup="$cleanup; kill $!" fi # --- Start a nice window manager --- enlightenment $EOPTS& # --- Crank up a screenlock program --- if ! $VNCSESSION; then xscreensaver-command -exit xscreensaver -no-splash& fi gnome-panel& # --- Emacs window measurements --- # # Horizontal column pixel width = 492; window manager overhead = 34 # Column character width = 82; Emacs magic overhead = -2 # Vertical line pixel height = 13; misc overhead = 52 emacs="noip emacs" # --- Xterm window measurements --- # # Window width is 503 (fixed). # Vertical line pixel height = 13; misc overhead = 23 xterm="pterm" xgeom=geometry # --- GNOME stuff measurements --- # # GNOME panel width = 113 declare -i xbound="XWIDTH - 113" # --- Choose a width for Emacs --- # # We'd like it to be as wide as possible, allowing for a column of xterms # down the right hand side. However, I'd prefer a double-width Emacs to a # single-width Emacs and xterms. If it's not going to work at all, a single # Emacs column will have to do. Also, there's a strange thing with Emacs21 # and the toolbar, so we add on some rows which are later mysteriously # subtracted. declare -i ecols="(xbound - 503 - 34)/492" if (( ecols < 2 && xbound > 492 * 2 + 34 )); then ecols=2 elif (( ecols < 1 )); then ecols=1 fi declare -i x="ecols * 492 + 34" $emacs -geometry $((ecols * 82 - 2))x$(((XHEIGHT - 52)/13))+0+0& # --- Now place some xterms --- # # A few smaller xterms are in general better than one great big one. 35 # lines is a good height for most terminals. 25 lines is a minimum. The # strategy for doling out xterms into a column is to make as many 35-liners # as we can, until the remaining space would be too small for a 25-liner. If # we can get two 25s out of that then we do (largest first); otherwise just # make one big one. We stop at the end of a page, once we've made three # xterms. declare -i n=0 pgx=0 l h y ht declare -i hstd="35 * 13 + 23" hmin="25 * 13 + 23" while true; do if ((x + 503 > xbound)); then if ((n >= 3)); then break; fi x="pgx + XWIDTH" pgx="pgx + XWIDTH" xbound="xbound + XWIDTH" fi y=0 ht=XHEIGHT while ((ht - hstd >= hmin)); do $xterm -$xgeom 80x35+$x+$y& y="y + hstd" ht="ht - hstd" n="n + 1" done if ((ht >= 2 * hmin)); then h="ht - hmin"; else h=ht; fi l="(h - 23)/13" h="l * 13 + 23" $xterm -$xgeom 80x$l+$x+$y& y="y + h" ht="ht - h" n="n + 1" if ((ht >= hmin)); then $xterm -$xgeom 80x25+$x+$y& n="n + 1" fi x="x + 503" done # --- Wait for the world to end --- xwait XWAIT_DIE:XWAIT_DIE_NOW eval "$cleanup"