1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
(use-modules (wm))
(define config
(make-config
;; Border sizes
2 ; inner-border-width
0 ; outer-border-width
16 ; magnet-border-width
;; Margins
0 ; offset-x
0 ; offset-y
0 ; offset-width
0 ; offset-height
;; Colors
"#35586c" ; focused-color
"#333333" ; unfocused-color
"#ff6666" ; unkillable-color
"#000000" ; empty-color
"#0d131a" ; outer-color
))
(define (make-callback proc . args)
(lambda () (apply proc args)))
(define terminal-cmd "xterm")
(define menu-raw-callback
(make-callback wm-exec-cmd "bemenu" "-b" "-s" "-l" "10" "-p" ">>>"))
(define menu-callback
(make-callback
wm-exec-cmd
"j4-dmenu-desktop"
"--dmenu=bemenu -b -i -s -l 10 -p >>>"
(string-append "--term=" terminal-cmd)))
(define wm-keybindings
`((,(make-shift-key "q") . ,wm-quit)
(,(make-key "q") . ,wm-focus-close)
(,(make-shift-key "p") . ,menu-raw-callback)
(,(make-key "p") . ,menu-callback)
(,(make-key "Enter") . ,(make-callback wm-exec-cmd terminal-cmd))
;; Focus
(,(make-key "Tab") . ,wm-focus-prev)
(,(make-shift-key "Tab") . ,wm-focus-next)
(,(make-key "k") . ,wm-focus-prev)
(,(make-key "j") . ,wm-focus-next)
;; Packing
(,(make-shift-key "Left") . ,wm-pack-left)
(,(make-shift-key "Right") . ,wm-pack-right)
(,(make-shift-key "Up") . ,wm-pack-top)
(,(make-shift-key "Down") . ,wm-pack-bottom)
;; Toggle between normal and tiled in a certain position
(,(make-key "s") . ,wm-toggle-maximize)
(,(make-key "a") . ,wm-toggle-half-left)
(,(make-key "Left") . ,wm-toggle-half-left)
(,(make-key "d") . ,wm-toggle-half-right)
(,(make-key "Right") . ,wm-toggle-half-right)
(,(make-key "w") . ,wm-toggle-half-top)
(,(make-key "Up") . ,wm-toggle-half-top)
(,(make-key "x") . ,wm-toggle-half-bottom)
(,(make-key "Down") . ,wm-toggle-half-bottom)
(,(make-key "q") . ,wm-toggle-top-left)
(,(make-key "e") . ,wm-toggle-top-right)
(,(make-key "z") . ,wm-toggle-bottom-left)
(,(make-key "c") . ,wm-toggle-bottom-right)
;; Set current workspace
(,(make-key "1") . ,(make-callback wm-set-workspace 0))
(,(make-key "2") . ,(make-callback wm-set-workspace 1))
(,(make-key "3") . ,(make-callback wm-set-workspace 2))
(,(make-key "4") . ,(make-callback wm-set-workspace 3))
(,(make-key "5") . ,(make-callback wm-set-workspace 4))
(,(make-key "6") . ,(make-callback wm-set-workspace 5))
(,(make-key "7") . ,(make-callback wm-set-workspace 6))
(,(make-key "8") . ,(make-callback wm-set-workspace 7))
(,(make-key "9") . ,(make-callback wm-set-workspace 8))
;; Send client to workspace
(,(make-shift-key "1") . ,(make-callback wm-set-focused-client-workspace 0))
(,(make-shift-key "2") . ,(make-callback wm-set-focused-client-workspace 1))
(,(make-shift-key "3") . ,(make-callback wm-set-focused-client-workspace 2))
(,(make-shift-key "4") . ,(make-callback wm-set-focused-client-workspace 3))
(,(make-shift-key "5") . ,(make-callback wm-set-focused-client-workspace 4))
(,(make-shift-key "6") . ,(make-callback wm-set-focused-client-workspace 5))
(,(make-shift-key "7") . ,(make-callback wm-set-focused-client-workspace 6))
(,(make-shift-key "8") . ,(make-callback wm-set-focused-client-workspace 7))
(,(make-shift-key "9") . ,(make-callback wm-set-focused-client-workspace 8))
;; Send client to monitor
(,(make-shift-key "i") . ,wm-client-monitor-prev)
(,(make-shift-key "o") . ,wm-client-monitor-next)))
(when (wm-init)
(wm-reconfigure config)
(wm-grab-keys wm-keybindings)
(wm-set-key-press-handler!
(lambda (mod keysym)
(display (list mod keysym))
(newline)))
(wm-run))
|