3 xrdb -override $HOME/.Xdefaults
5 export __mdw_sechost="`hostname`"
7 # --- Do some fiddling ---
13 gnome-settings-daemon&
15 $VNCSESSION || gkrellm&
18 # --- Crank up ESD ---
20 if ! [ -r /tmp/.esd/socket ]; then
22 cleanup="$cleanup; kill $!"
25 # --- Start a nice window manager ---
29 # --- Crank up a screenlock program ---
31 if ! $VNCSESSION; then
32 xscreensaver-command -exit
33 xscreensaver -no-splash&
37 # --- Emacs window measurements ---
39 # Horizontal column pixel width = 492; window manager overhead = 34
40 # Column character width = 82; Emacs magic overhead = -2
41 # Vertical line pixel height = 13; misc overhead = 52
45 # --- Xterm window measurements ---
47 # Window width is 504 (fixed).
48 # Vertical line pixel height = 13; misc overhead = 23
50 xterm="Eterm" xgeom=-geometry
52 # --- GNOME stuff measurements ---
54 # GNOME panel width = 113
56 declare -i xbound="XWIDTH - 113"
58 # --- Choose a width for Emacs ---
60 # We'd like it to be as wide as possible, allowing for a column of xterms
61 # down the right hand side. However, I'd prefer a double-width Emacs to a
62 # single-width Emacs and xterms. If it's not going to work at all, a single
63 # Emacs column will have to do. Also, there's a strange thing with Emacs21
64 # and the toolbar, so we add on some rows which are later mysteriously
67 declare -i ecols="(xbound - 504 - 34)/492"
68 if (( ecols < 2 && xbound > 492 * 2 + 34 )); then
70 elif (( ecols < 1 )); then
74 declare -i x="ecols * 492 + 34"
75 $emacs -geometry $((ecols * 82 - 2))x$(((XHEIGHT - 52)/13))+0+0&
77 # --- Now place some xterms ---
79 # A few smaller xterms are in general better than one great big one. 35
80 # lines is a good height for most terminals. 25 lines is a minimum. The
81 # strategy for doling out xterms into a column is to make as many 35-liners
82 # as we can, until the remaining space would be too small for a 25-liner. If
83 # we can get two 25s out of that then we do (largest first); otherwise just
84 # make one big one. We stop at the end of a page, once we've made three
87 declare -i n=0 pgx=0 l h y ht
88 declare -i hstd="35 * 13 + 23" hmin="25 * 13 + 23"
90 if ((x + 504 > xbound)); then
91 if ((n >= 3)); then break; fi
92 x="pgx + XWIDTH" pgx="pgx + XWIDTH" xbound="xbound + XWIDTH"
95 while ((ht - hstd >= hmin)); do
96 $xterm -$xgeom 80x35+$x+$y&
97 y="y + hstd" ht="ht - hstd" n="n + 1"
99 if ((ht >= 2 * hmin)); then h="ht - hmin"; else h=ht; fi
100 l="(h - 23)/13" h="l * 13 + 23"
101 $xterm -$xgeom 80x$l+$x+$y&
102 y="y + h" ht="ht - h" n="n + 1"
103 if ((ht >= hmin)); then
104 $xterm -$xgeom 80x25+$x+$y&
110 # --- Wait for the world to end ---
112 xwait XWAIT_DIE:XWAIT_DIE_NOW