Commit | Line | Data |
---|---|---|
f617db13 MW |
1 | #! /bin/bash |
2 | ||
3 | xrdb -override $HOME/.Xdefaults | |
ec2de2b7 | 4 | : ${VNCSESSION=false} |
f617db13 MW |
5 | export __mdw_sechost="`hostname`" |
6 | ||
7 | # --- Do some fiddling --- | |
8 | ||
9 | cleanup=":" | |
10 | xset b 10 2000 50 | |
11 | xset r rate 500 50 | |
12 | xset m 1 1 | |
13 | gnome-settings-daemon& | |
14 | mail-notification& | |
ec2de2b7 | 15 | $VNCSESSION || gkrellm& |
f617db13 MW |
16 | eval `xscsize -bx` |
17 | ||
18 | # --- Crank up ESD --- | |
19 | ||
20 | if ! [ -r /tmp/.esd/socket ]; then | |
21 | esd -nobeeps -as 10& | |
22 | cleanup="$cleanup; kill $!" | |
23 | fi | |
24 | ||
25 | # --- Start a nice window manager --- | |
26 | ||
27 | enlightenment $EOPTS& | |
28 | ||
29 | # --- Crank up a screenlock program --- | |
30 | ||
ec2de2b7 | 31 | if ! $VNCSESSION; then |
f617db13 MW |
32 | xscreensaver-command -exit |
33 | xscreensaver -no-splash& | |
34 | fi | |
35 | gnome-panel& | |
f617db13 MW |
36 | |
37 | # --- Emacs window measurements --- | |
38 | # | |
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 | |
42 | ||
43 | emacs="noip emacs" | |
44 | ||
45 | # --- Xterm window measurements --- | |
46 | # | |
1c6b19d4 | 47 | # Window width is 503 (fixed). |
f617db13 MW |
48 | # Vertical line pixel height = 13; misc overhead = 23 |
49 | ||
1c6b19d4 | 50 | xterm="pterm" xgeom=geometry |
f617db13 MW |
51 | |
52 | # --- GNOME stuff measurements --- | |
53 | # | |
54 | # GNOME panel width = 113 | |
55 | ||
56 | declare -i xbound="XWIDTH - 113" | |
57 | ||
58 | # --- Choose a width for Emacs --- | |
59 | # | |
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 | |
65 | # subtracted. | |
66 | ||
1c6b19d4 | 67 | declare -i ecols="(xbound - 503 - 34)/492" |
f617db13 MW |
68 | if (( ecols < 2 && xbound > 492 * 2 + 34 )); then |
69 | ecols=2 | |
70 | elif (( ecols < 1 )); then | |
71 | ecols=1 | |
72 | fi | |
73 | ||
74 | declare -i x="ecols * 492 + 34" | |
75 | $emacs -geometry $((ecols * 82 - 2))x$(((XHEIGHT - 52)/13))+0+0& | |
76 | ||
77 | # --- Now place some xterms --- | |
78 | # | |
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 | |
85 | # xterms. | |
86 | ||
87 | declare -i n=0 pgx=0 l h y ht | |
88 | declare -i hstd="35 * 13 + 23" hmin="25 * 13 + 23" | |
89 | while true; do | |
1c6b19d4 | 90 | if ((x + 503 > xbound)); then |
f617db13 MW |
91 | if ((n >= 3)); then break; fi |
92 | x="pgx + XWIDTH" pgx="pgx + XWIDTH" xbound="xbound + XWIDTH" | |
93 | fi | |
94 | y=0 ht=XHEIGHT | |
95 | while ((ht - hstd >= hmin)); do | |
96 | $xterm -$xgeom 80x35+$x+$y& | |
97 | y="y + hstd" ht="ht - hstd" n="n + 1" | |
98 | done | |
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& | |
105 | n="n + 1" | |
106 | fi | |
1c6b19d4 | 107 | x="x + 503" |
f617db13 MW |
108 | done |
109 | ||
110 | # --- Wait for the world to end --- | |
111 | ||
112 | xwait XWAIT_DIE:XWAIT_DIE_NOW | |
113 | eval "$cleanup" |