-
Notifications
You must be signed in to change notification settings - Fork 93
/
keys.clj
116 lines (103 loc) · 3.35 KB
/
keys.clj
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
(ns etaoin.keys
"Key and mouse constants. And chords.
Sourced from [WebDriver spec](https://www.w3.org/TR/webdriver/#keyboard-actions).")
(set! *warn-on-reflection* true)
(def unidentified \uE000)
(def cancel \uE001)
(def help \uE002)
(def backspace \uE003)
(def tab \uE004)
(def clear \uE005)
(def return \uE006)
(def enter \uE007)
(def shift-left \uE008)
(def control-left \uE009)
(def alt-left \uE00A)
(def pause \uE00B)
(def escape \uE00C)
(def space \uE00D)
(def pageup \uE00E)
(def pagedown \uE00F)
(def end \uE010)
(def home \uE011)
(def arrow-left \uE012)
(def arrow-up \uE013)
(def arrow-right \uE014)
(def arrow-down \uE015)
(def insert \uE016)
(def delete \uE017)
(def semicolon \uE018)
(def equal \uE019)
(def num-0 \uE01A)
(def num-1 \uE01B)
(def num-2 \uE01C)
(def num-3 \uE01D)
(def num-4 \uE01E)
(def num-5 \uE01F)
(def num-6 \uE020)
(def num-7 \uE021)
(def num-8 \uE022)
(def num-9 \uE023)
(def num-* \uE024)
(def num-+ \uE025)
(def num-comma \uE026)
(def num-- \uE027)
(def num-dot \uE028)
(def num-slash \uE029)
(def f1 \uE031)
(def f2 \uE032)
(def f3 \uE033)
(def f4 \uE034)
(def f5 \uE035)
(def f6 \uE036)
(def f7 \uE037)
(def f8 \uE038)
(def f9 \uE039)
(def f10 \uE03A)
(def f11 \uE03B)
(def f12 \uE03C)
(def meta-left \uE03D)
(def zenkakuhankaku \uE040)
(def shift-right \uE050)
(def control-right \uE051)
(def alt-right \uE052)
(def meta-right \uE053)
(def num-page-up \uE054)
(def num-page-down \uE055)
(def num-end \uE056)
(def num-home \uE057)
(def num-arrow-left \uE058)
(def num-arrow-up \uE059)
(def num-arrow-right \uE05A)
(def num-arrow-down \uE05B)
(def num-insert \uE05C)
(def num-delete \uE05D)
(def command meta-left)
(defn chord
"Apply `key` to `more` where `more` can be more keys or regular text.
Any keys that are pressed are released.
Example:
```Clojure
(chord shift-left \"help\" backspace \"lo\")
;; would effectively be: HELLO
```"
[key & more]
(str (apply str key more) unidentified))
(def ^{:arglists '([& more])} with-shift
"Apply shift key to `more` where `more` can be more keys or regular text."
(partial chord shift-left))
(def ^{:arglists '([& more])} with-ctrl
"Apply ctrl key to `more` where `more` can be more keys or regular text."
(partial chord control-left))
(def ^{:arglists '([& more])} with-alt
"Apply alt key to `more` where `more` can be more keys or regular text."
(partial chord alt-left))
(def ^{:arglists '([& more])} with-command
"Apply command key to `more` where `more` can be more keys or regular text."
(partial chord command))
;;
;; Mouse codes
;;
(def mouse-left 0)
(def mouse-middle 1)
(def mouse-right 2)