summary refs log tree commit diff stats
path: root/bin/acdwm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'bin/acdwm.scm')
-rwxr-xr-xbin/acdwm.scm55
1 files changed, 55 insertions, 0 deletions
diff --git a/bin/acdwm.scm b/bin/acdwm.scm new file mode 100755 index 0000000..cfa5983 --- /dev/null +++ b/bin/acdwm.scm
@@ -0,0 +1,55 @@
1#!/bin/sh
2#| -*- scheme -*-
3exec csi -s "$0" "$@" ; acdwm
4|#
5
6(import (chicken condition)
7 (acdwm util)
8 (acdwm xlib)
9 (acdwm keys)
10 (acdwm events))
11
12;;; Configuration
13;; TODO: this should go in its own file
14(bind "M-<F1>" (lambda (ev dpy)
15 (let ((win (xevent-xkey-subwindow ev)))
16 (when (some? win)
17 (xraisewindow dpy win)))))
18(bind "M-b1" (lambda (ev dpy)
19 (xraisewindow dpy (xevent-xbutton-subwindow ev))
20 (initialize-drag 'move ev)))
21(bind "M-b3" (lambda (ev dpy)
22 (xraisewindow dpy (xevent-xbutton-subwindow ev))
23 (initialize-drag 'resize ev)))
24
25;;; Main entry point
26
27(define (acdwm-setup)
28 (or (get-display)
29 (error "Can't capture display"))
30 (grab-input))
31
32(define (acdwm-cleanup)
33 (dprint "Cleaning up"))
34
35(define (main args)
36 (parameterize ((DEBUG #t))
37 (dprint "acdwm: starting up")
38 (dynamic-wind acdwm-setup
39 (lambda ()
40 (call/cc
41 (lambda (k)
42 (with-exception-handler
43 (lambda (exn)
44 (xclosedisplay (get-display))
45 (k exn))
46 handle-events))))
47 acdwm-cleanup))
48 (xclosedisplay (get-display))
49 (exit))
50
51(cond-expand
52 ((or chicken-script compiling)
53 (import (chicken process-context))
54 (main (command-line-arguments)))
55 (else))