diff options
author | Case Duckworth | 2024-01-02 22:07:15 -0600 |
---|---|---|
committer | Case Duckworth | 2024-01-02 22:07:15 -0600 |
commit | b9d785aa9c681f0a6c804eec9bc356aaca78f3ee (patch) | |
tree | a42279dda8b02fc259685df455f8850539e73a8e | |
download | acdwm-0.0.tar.gz acdwm-0.0.zip |
initial commit v0.0
-rw-r--r-- | .gitignore | 3 | ||||
-rwxr-xr-x | acdwm | bin | 0 -> 70664 bytes | |||
-rw-r--r-- | acdwm.egg | 9 | ||||
-rwxr-xr-x | acdwm.scm | 110 | ||||
-rwxr-xr-x | ok | 19 |
5 files changed, 141 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..75039f1 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | .fr | ||
2 | *.build.sh | ||
3 | *.install.sh \ No newline at end of file | ||
diff --git a/acdwm b/acdwm new file mode 100755 index 0000000..a847fa2 --- /dev/null +++ b/acdwm | |||
Binary files differ | |||
diff --git a/acdwm.egg b/acdwm.egg new file mode 100644 index 0000000..a0fb9ce --- /dev/null +++ b/acdwm.egg | |||
@@ -0,0 +1,9 @@ | |||
1 | ;; -*- scheme -*- | ||
2 | |||
3 | ((synopsis "acdw indow manager") | ||
4 | (author "Case Duckworth") | ||
5 | (license "God Willing") | ||
6 | (version 0.0.0) | ||
7 | (dependencies matchable xlib srfi-1) | ||
8 | (components | ||
9 | (program acdwm))) | ||
diff --git a/acdwm.scm b/acdwm.scm new file mode 100755 index 0000000..fdd8395 --- /dev/null +++ b/acdwm.scm | |||
@@ -0,0 +1,110 @@ | |||
1 | #!/bin/sh | ||
2 | #| -*- scheme -*- | ||
3 | exec csi -ss "$0" "$@" ; acdwm | ||
4 | based on tinywm: https://github.com/mackstann/tinywm/ | ||
5 | |# | ||
6 | |||
7 | (import (chicken bitwise) | ||
8 | (chicken process-context) | ||
9 | (srfi 1) | ||
10 | matchable | ||
11 | xlib) | ||
12 | |||
13 | (define TRUE 1) | ||
14 | (define FALSE 0) | ||
15 | |||
16 | (define dpy (make-parameter #f)) | ||
17 | (define screen (make-parameter #f)) | ||
18 | (define root (make-parameter #f)) | ||
19 | |||
20 | (define (grab-keys) | ||
21 | (xgrabkey (dpy) | ||
22 | (char->integer (xkeysymtokeycode (dpy) (xstringtokeysym "F1"))) | ||
23 | MOD1MASK | ||
24 | (root) | ||
25 | TRUE | ||
26 | GRABMODEASYNC | ||
27 | GRABMODEASYNC) | ||
28 | (xgrabbutton (dpy) | ||
29 | 1 | ||
30 | MOD1MASK | ||
31 | (root) | ||
32 | TRUE | ||
33 | (bitwise-ior BUTTONPRESSMASK | ||
34 | BUTTONRELEASEMASK | ||
35 | POINTERMOTIONMASK) | ||
36 | GRABMODEASYNC | ||
37 | GRABMODEASYNC | ||
38 | NONE | ||
39 | NONE) | ||
40 | (xgrabbutton (dpy) | ||
41 | 3 | ||
42 | MOD1MASK | ||
43 | (root) | ||
44 | TRUE | ||
45 | (bitwise-ior BUTTONPRESSMASK | ||
46 | BUTTONRELEASEMASK | ||
47 | POINTERMOTIONMASK) | ||
48 | GRABMODEASYNC | ||
49 | GRABMODEASYNC | ||
50 | NONE | ||
51 | NONE)) | ||
52 | |||
53 | (define (handle-events) | ||
54 | (let ((event (make-xevent)) | ||
55 | (start (make-xbuttonevent)) | ||
56 | (attrs (make-xwindowattributes))) | ||
57 | (set-xbuttonevent-subwindow! start NONE) | ||
58 | (let loop () | ||
59 | (xnextevent (dpy) event) | ||
60 | (cond | ||
61 | ((and (= KEYPRESS (xevent-type event)) | ||
62 | (not (= NONE (xevent-xkey-subwindow event)))) | ||
63 | (xraisewindow (dpy) (xevent-xkey-subwindow event))) | ||
64 | |||
65 | ((and (= BUTTONPRESS (xevent-type event)) | ||
66 | (not (= NONE (xevent-xbutton-subwindow event)))) | ||
67 | (print "button!") | ||
68 | (xgetwindowattributes (dpy) (xevent-xbutton-subwindow event) attrs) | ||
69 | (set-xbuttonevent-x_root! start (xevent-xbutton-x_root event)) | ||
70 | (set-xbuttonevent-y_root! start (xevent-xbutton-y_root event)) | ||
71 | (set-xbuttonevent-button! start (xevent-xbutton-button event)) | ||
72 | (set-xbuttonevent-subwindow! start (xevent-xbutton-subwindow event))) | ||
73 | |||
74 | ((and (= MOTIONNOTIFY (xevent-type event)) | ||
75 | (not (= NONE (xbuttonevent-subwindow start)))) | ||
76 | (let ((xdiff (- (xevent-xbutton-x_root event) | ||
77 | (xbuttonevent-x_root start))) | ||
78 | (ydiff (- (xevent-xbutton-y_root event) | ||
79 | (xbuttonevent-y_root start))) | ||
80 | (button (xbuttonevent-button start))) | ||
81 | (xmoveresizewindow (dpy) | ||
82 | (xbuttonevent-subwindow start) | ||
83 | (+ (xwindowattributes-x attrs) | ||
84 | (if (= button 1) xdiff 0)) | ||
85 | (+ (xwindowattributes-y attrs) | ||
86 | (if (= button 1) ydiff 0)) | ||
87 | (max 1 (+ (xwindowattributes-width attrs) | ||
88 | (if (= button 3) xdiff 0))) | ||
89 | (max 1 (+ (xwindowattributes-height attrs) | ||
90 | (if (= button 3) ydiff 0)))))) | ||
91 | |||
92 | ((= BUTTONRELEASE (xevent-type event)) | ||
93 | (print "buttonrelease!") | ||
94 | (set-xbuttonevent-subwindow! start NONE))) | ||
95 | |||
96 | ;; Annnd go around again | ||
97 | (loop)))) | ||
98 | |||
99 | (define (main args) | ||
100 | (parameterize ((dpy (xopendisplay #f))) | ||
101 | (assert (dpy)) | ||
102 | (parameterize ((screen (xdefaultscreen (dpy)))) | ||
103 | (parameterize ((root (xrootwindow (dpy) (screen)))) | ||
104 | (grab-keys) | ||
105 | (handle-events))))) | ||
106 | |||
107 | (cond-expand | ||
108 | ((or chicken-script compiling) | ||
109 | (main (command-line-arguments))) | ||
110 | (else)) | ||
diff --git a/ok b/ok new file mode 100755 index 0000000..c135a93 --- /dev/null +++ b/ok | |||
@@ -0,0 +1,19 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | fr<<. | ||
4 | acdwm chickenbuild acdwm.scm | ||
5 | . | ||
6 | |||
7 | xephyr(){ | ||
8 | dep acdwm | ||
9 | quietly killall Xephyr | ||
10 | ok Xephyr -ac -screen 800x600 -br -reset -terminate 2>/dev/null :1 & | ||
11 | sleep 1 | ||
12 | xterm -display :1 & | ||
13 | xterm -display :1 -geometry +100+100 & | ||
14 | ok env DISPLAY=:1 ./acdwm | ||
15 | } | ||
16 | |||
17 | chickenbuild(){ | ||
18 | ok chicken-install -n | ||
19 | } | ||