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