HTML updates
[clinton/website/site/unknownlamer.org.git] / SCWM.html
1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <title>Scheme Your Windows</title>
7 <meta name="generator" content="muse.el" />
8 <meta http-equiv="Content-Type"
9 content="text/html; charset=utf-8" />
10 <link rel="stylesheet" href="default.css" media="screen" />
11 </head>
12 <body>
13 <h1>Scheme Your Windows</h1>
14 <div class="contents">
15 <dl>
16 <dt>
17 <a href="#sec1">Installing SCWM</a>
18 </dt>
19 <dd>
20 <dl>
21 <dt>
22 <a href="#sec2">Dependencies</a>
23 </dt>
24 <dd>
25 <dl>
26 <dt>
27 <a href="#sec3">Required</a>
28 </dt>
29 <dt>
30 <a href="#sec4">Optional</a>
31 </dt>
32 </dl>
33 </dd>
34 <dt>
35 <a href="#sec5">Downloading and Building</a>
36 </dt>
37 <dt>
38 <a href="#sec6">Running</a>
39 </dt>
40 <dt>
41 <a href="#sec7">Hacking</a>
42 </dt>
43 <dd>
44 <dl>
45 <dt>
46 <a href="#sec8">XNested Setup</a>
47 </dt>
48 <dt>
49 <a href="#sec9">GDS for Interaction</a>
50 </dt>
51 </dl>
52 </dd>
53 </dl>
54 </dd>
55 </dl>
56 </div>
57
58
59 <!-- Page published by Emacs Muse begins here --><h2><a name="sec1" id="sec1"></a>
60 Installing SCWM</h2>
61
62 <h3><a name="sec2" id="sec2"></a>
63 Dependencies</h3>
64
65 <h4><a name="sec3" id="sec3"></a>
66 Required</h4>
67
68 <ul>
69 <li><a href="http://www.gnu.org/software/guile">Guile</a> 1.8.0+</li>
70 <li>IMLib 1.x (in Debian imlib11-dev)</li>
71 </ul>
72
73
74 <h4><a name="sec4" id="sec4"></a>
75 Optional</h4>
76
77 <ul>
78 <li><a href="ftp://ftp.gnu.org/gnu/guile-gtk/guile-gtk-0.60.tar.gz">Guile-GTK</a> 0.60 for dialog support. Guile-GTK 2.x and scwm are not
79 compatible yet</li>
80 </ul>
81
82
83
84 <h3><a name="sec5" id="sec5"></a>
85 Downloading and Building</h3>
86
87 <p class="first">A working version of SCWM can be obtained from
88 <a href="http://sourceforge.net/cvs/?group_id=225">sourceforge CVS</a>. Compilation is much more straightforward than one
89 would suspect from a project so old (thanks to dsmith for doing the
90 painful parts of unbitrotting). The standard autoconf sequence of
91 commands should work.</p>
92
93 <pre class="example">
94 ./autogen.sh
95 ./configure
96 make
97 sudo make install
98 </pre>
99
100
101 <h3><a name="sec6" id="sec6"></a>
102 Running</h3>
103
104 <p class="first">The directory <code>sample.scwmrc</code> has a few sample SCWM
105 configurations. <code>system.scwmrc</code> and <code>sample.scwmrc</code> both work fairly well;
106 I have yet to test the others. If not using <code>system.scwmrc</code> it is useful
107 to at least include the bits that enable debugging.</p>
108
109 <pre class="src">
110 (<span style="color: #00ffff;">define</span> <span style="color: #87cefa;">debug</span> #t)
111
112 (<span style="color: #00ffff;">if</span> debug
113 (<span style="color: #00ffff;">begin</span>
114 (add-hook! module-loaded-hook display-module-loaded)
115 (set! %load-verbosely #t)
116 (debug-enable 'debug 'backtrace)
117 (read-enable 'positions)))
118 </pre>
119
120 <p>SCWM will attempt to load <code>system.scwmrc</code> by default, but this can be
121 overridden with the <code>-f</code> option. The default <code>system.scwmrc</code> loads user
122 config from a series of files in <code>~/.scwm/</code>.</p>
123
124
125 <h3><a name="sec7" id="sec7"></a>
126 Hacking</h3>
127
128 <h4><a name="sec8" id="sec8"></a>
129 XNested Setup</h4>
130
131 <p class="first">The easiest way to hack on SCWM is to run it inside of Xnest.</p>
132
133 <pre class="example">
134 Xnest :1 &amp;
135 scwm --display :1 --debug # --debug makes X requests synchronous
136 </pre>
137
138
139 <h4><a name="sec9" id="sec9"></a>
140 GDS for Interaction</h4>
141
142 <p class="first">SCWM has an emacs interaction mode that communicates with the window
143 manager using X window properties, but the emacs side of the code
144 doesn't quite work, and GDS is featureful enough now to be used to
145 interact with scwm. Using GDS makes hacking scwm quite a bit
146 easier. <strong>GDS requires a Guile built with threads to work properly
147 (the version in Debian is built <em>without</em> threading).</strong></p>
148
149 <h5>scwmrc code</h5>
150
151 <p>The following code should be in your scwmrc somewhere.</p>
152
153 <pre class="src">
154 (use-modules (ice-9 gds-client)
155 (ice-9 threads))
156
157 <span style="color: #ff7f24;">;;; </span><span style="color: #ff7f24;">GDS thread (in case it must be killed during debugging, ...)
158 </span>(<span style="color: #00ffff;">define</span> <span style="color: #87cefa;">cke-gds-thread</span> #f)
159
160 (<span style="color: #00ffff;">define</span> (<span style="color: #87cefa;">connect-to-debugging-server</span>)
161 (set! cke-gds-thread
162 (call-with-new-thread (<span style="color: #00ffff;">lambda</span> () (run-utility))))
163 cke-gds-thread)
164 </pre>
165
166 <p>After defining you can either use <code>scwmrepl</code> to run
167 <code>(connect-to-debugging-server)</code> after starting a GDS server, or simply
168 add <code>(connect-to-debugging-server)</code> to the config if one will always be
169 running.</p>
170
171
172 <h5>Emacs config</h5>
173
174 <p>I wrote <a href="http://darcs.unknownlamer.org/site-emacs/init.d/guile-debug.el">a bit of elisp</a> to simplify setting up a scratch buffer for
175 interaction with guile.</p>
176
177 <pre class="src">
178 (<span style="color: #00ffff;">require</span> '<span style="color: #7fffd4;">gds</span>)
179 (<span style="color: #00ffff;">require</span> '<span style="color: #7fffd4;">gds-server</span>)
180 (<span style="color: #00ffff;">require</span> '<span style="color: #7fffd4;">gds-scheme</span>)
181
182 (<span style="color: #00ffff;">defvar</span> <span style="color: #eedd82;">guile-scratch-buffer-name</span> <span style="color: #b3b3b3;">"*guile-scratch*"</span>
183 <span style="color: #b3b3b3;">"Name of the Guile evaluation scratch buffer"</span>)
184
185 (<span style="color: #00ffff;">defun</span> <span style="color: #87cefa;">make-guile-scratch-buffer</span> ()
186 (interactive)
187 (<span style="color: #00ffff;">let</span> ((scratch-buf (generate-new-buffer guile-scratch-buffer-name)))
188 (switch-to-buffer scratch-buf)
189 (scheme-mode)
190 (gds-auto-associate-buffer)))
191 </pre>
192
193 <p>If you were already running a debugging client process you will need
194 to choose the process to associate the buffer with; <code>ps</code> will tell you
195 the PID of scwm.</p>
196
197
198 <h5>Known Issues</h5>
199
200 <p>Occasionally evaluating an expression or viewing a backtrace will make
201 scwm lockup. My understanding is that scwm is not threadsafe, and
202 there are some evil issues that will take a while to solve. GDS works
203 well enough for now; if I can't make GDS completely reliable I shall
204 unbitrot the scwm emacs interaction mode (unless someone else beats me
205 to it, <em>hint hint</em>).</p>
206
207
208
209
210
211 <!-- Page published by Emacs Muse ends here -->
212
213 <p class="cke-buttons">
214 <!-- validating badges, any browser, etc -->
215 <a href="http://validator.w3.org/check/referer"><img
216 src="http://www.w3.org/Icons/valid-xhtml10"
217 alt="Valid XHTML 1.0!" /></a>
218
219 <a href="http://www.anybrowser.org/campaign/"><img
220 src="img/buttons/w3c_ab.png" alt="[ Viewable With Any Browser
221 ]" /></a>
222
223 <a href="http://www.debian.org/"><img
224 src="img/buttons/debian.png" alt="[ Powered by Debian ]" /></a>
225
226 <a href="http://hcoop.net/">
227 <img src="img/buttons/hcoop.png"
228 alt="[ Hosted by HCoop]" />
229 </a>
230
231 <a href="http://www.fsf.org/register_form?referrer=114">
232 <img src="img/buttons/fsf_member.png"
233 alt="[ FSF Associate Member ]" />
234 </a>
235 </p>
236
237 <p class="cke-footer">The body bags and little rags of children torn in two,
238 And the jellied brains of those who remain to put the finger right on you
239 As the madmen play on words and make us all dance to their song
240 To the tune of starving millions to make a better kind of gun.
241 </p>
242 <p class="cke-timestamp">Last Modified:
243 March 13, 2008</p>
244 </body>
245 </html>