-
Notifications
You must be signed in to change notification settings - Fork 0
/
xbindkeysrc-combo.scm
89 lines (74 loc) · 2.14 KB
/
xbindkeysrc-combo.scm
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Start of xbindkeys configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This configuration is guile based.
;;
;; This configuration allow combo keys.
;; ie Control+z Control+e -> xterm
;; Control+z z -> rxvt
;; Control+z Control+g -> quit second mode
;;
;; It also allow to add or remove a key on the fly!
(define (display-n str)
"Display a string then newline"
(display str)
(newline))
(define (first-binding)
"First binding"
(xbindkey '(control shift q) "xterm")
(xbindkey-function '(control a)
(lambda ()
(display "Hello from Scheme!")
(newline)))
(xbindkey-function '(shift p)
(lambda ()
(run-command "xterm")))
;; set directly keycode (here shift + m with my keyboard)
(xbindkey-function '("m:0x1" "c:47")
(lambda ()
(display "------ Adding control k -----")
(newline)
(xbindkey '(control k) "rxvt")
(grab-all-keys)))
(xbindkey-function '(shift i)
(lambda ()
(display "Remove control k")
(newline)
(remove-xbindkey '(control k))
(grab-all-keys)))
(xbindkey-function '(shift o)
(lambda ()
(display "Remove control a")
(newline)
(remove-xbindkey '(control a))
(grab-all-keys)))
(xbindkey-function '(control z) second-binding))
(define (reset-first-binding)
"reset first binding"
(display-n "reset first binding")
(ungrab-all-keys)
(remove-all-keys)
(first-binding)
(grab-all-keys))
(define (second-binding)
"Second binding"
(display "New binding")
(ungrab-all-keys)
(remove-all-keys)
(xbindkey-function '(control e)
(lambda ()
(display-n "Control e")
(run-command "xterm")
(reset-first-binding)))
(xbindkey-function 'z
(lambda ()
(display-n "z (second)")
(run-command "rxvt")
(reset-first-binding)))
(xbindkey-function '(control g) reset-first-binding)
(debug)
(grab-all-keys))
(first-binding)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; End of xbindkeys configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;