3 xx
= tt
=:; if [ "$XINIT_TEST" != "" ]; then xx
=: tt
=echo; set -x
; fi
4 $xx xrdb
-override
$HOME/.Xdefaults
6 export __mdw_sechost
="`hostname`"
8 # --- Do some fiddling ---
14 $xx mail-notification
&
15 $xx $VNCSESSION ||
$xx gkrellm
&
16 if [ "$XINIT_TEST" = "" ] ||
[ "$XWIDTH" = "" ] ||
[ "$XHEIGHT" = "" ]; then
20 # --- Crank up ESD ---
22 if ! $xx [ -r
/tmp
/.esd
/socket
]; then
24 cleanup
="$cleanup; kill $!"
27 # --- Picking appropriate programs ---
31 if type -t
>/dev
/null
"$i"; then echo "$i"; return; fi
36 # --- Start a nice window manager ---
38 : ${wm=$(pick_program enlightenment e16)}
39 $tt Window manager is
$wm.
42 # --- Crank up a screenlock program ---
44 if ! $xx $VNCSESSION; then
45 xscreensaver-command
-exit
46 xscreensaver
-no-splash
&
47 $xx gnome-settings-daemon
&
51 # --- Emacs window measurements ---
53 # Horizontal column pixel width = 492; window manager overhead = 34
54 # Column character width = 82; Emacs magic overhead = -2
55 # Vertical line pixel height = 13; misc overhead = 52
57 : ${emacs=$(pick_program emacs22 emacs21)}
58 $tt Using editor
$emacs.
61 e_colwd
=492 e_hextra
=34
62 e_colchars
=82 e_cextra
=-2
63 e_lineht
=13 e_vextra
=52
66 e_colwd
=492 e_hextra
=8
67 e_colchars
=82 e_cextra
=-6
68 e_lineht
=13 e_vextra
=46
72 # --- Xterm window measurements ---
74 # Window width is 503 (fixed).
75 # Vertical line pixel height = 13; misc overhead = 23
77 : ${term=$(pick_program pterm Eterm xterm)}
78 $tt Using terminal
$tt
80 pterm
) t_wd
=503 t_lineht
=13 t_vextra
=23 geom
=-geometry
;;
81 Eterm
) t_wd
=504 t_lineht
=13 t_vextra
=23 geom
=-g
;;
82 xterm
) t_wd
=507 t_lineht
=13 t_vextra
=27 geom
=-geometry
;;
85 # --- GNOME stuff measurements ---
87 # GNOME panel width = 113
89 declare -i xbound
="XWIDTH - 113"
91 # --- Choose a width for Emacs ---
93 # We'd like it to be as wide as possible, allowing for a column of xterms
94 # down the right hand side. However, I'd prefer a double-width Emacs to a
95 # single-width Emacs and xterms. If it's not going to work at all, a single
96 # Emacs column will have to do. Also, there's a strange thing with Emacs21
97 # and the toolbar, so we add on some rows which are later mysteriously
100 declare -i ecols
="(xbound - t_wd - e_hextra)/e_colwd"
101 if (( ecols
< 2 && xbound
> e_colwd
* 2 + e_hextra
)); then
103 elif (( ecols
< 1 )); then
107 declare -i x
="ecols * e_colwd + e_hextra"
108 noip
$emacs -geometry $
((ecols
* e_colchars
+ e_cextra
))x$
(((XHEIGHT
- e_vextra
)/e_lineht
))+0+0&
110 # --- Now place some xterms ---
112 # A few smaller xterms are in general better than one great big one. 35
113 # lines is a good height for most terminals. 25 lines is a minimum. The
114 # strategy for doling out xterms into a column is to make as many 35-liners
115 # as we can, until the remaining space would be too small for a 25-liner. If
116 # we can get two 25s out of that then we do (largest first); otherwise just
117 # make one big one. We stop at the end of a page, once we've made three
120 declare -i n
=0 pgx
=0 l h y ht
121 declare -i hstd
="35 * t_lineht + t_vextra" hmin
="25 * t_lineht + t_vextra"
123 if ((x
+ t_wd
> xbound
)); then
124 if ((n
>= 3)); then break; fi
125 x
="pgx + XWIDTH" pgx
="pgx + XWIDTH" xbound
="xbound + XWIDTH"
128 while ((ht
- hstd
>= hmin
)); do
129 $term $geom 80x35
+$x+$y&
130 y
="y + hstd" ht
="ht - hstd" n
="n + 1"
132 if ((ht
>= 2 * hmin
)); then h
="ht - hmin"; else h
=ht
; fi
133 l
="(h - t_vextra)/t_lineht" h
="l * t_lineht + t_vextra"
134 $term $geom 80x
$l+$x+$y&
135 y
="y + h" ht
="ht - h" n
="n + 1"
136 if ((ht
>= hmin
)); then
137 $term $geom 80x25
+$x+$y&
143 # --- Wait for the world to end ---
145 $xx xwait XWAIT_DIE
:XWAIT_DIE_NOW