diff options
author | Case Duckworth | 2024-01-17 00:24:11 -0600 |
---|---|---|
committer | Case Duckworth | 2024-01-17 00:24:11 -0600 |
commit | 8179c0025a44a769ab6ad2e5c0a58f545517280c (patch) | |
tree | 8de19b673bbddbfcbb03c7d2363ca937ccf4aa3b /bin/acdwm.scm | |
parent | Update .gitignore (diff) | |
download | acdwm-b21871cf2d002b62c52eb75f0687cf1bf8b7877f.tar.gz acdwm-b21871cf2d002b62c52eb75f0687cf1bf8b7877f.zip |
Change organization and massively refactor v001
Diffstat (limited to 'bin/acdwm.scm')
-rwxr-xr-x | bin/acdwm.scm | 55 |
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 -*- | ||
3 | exec 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)) | ||