├── .gitignore
├── .gitattributes
├── .travis.yml
├── icon.png
├── media
└── screencast.gif
├── keycode.alfredworkflow
├── .prettierrc
├── .editorconfig
├── test.js
├── readme.md
├── package.json
├── LICENSE
├── info.plist
└── index.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.js text eol=lf
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - '6'
4 | - '4'
5 |
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/radibit/alfred-keycode/HEAD/icon.png
--------------------------------------------------------------------------------
/media/screencast.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/radibit/alfred-keycode/HEAD/media/screencast.gif
--------------------------------------------------------------------------------
/keycode.alfredworkflow:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/radibit/alfred-keycode/HEAD/keycode.alfredworkflow
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 85,
3 | "trailingComma": "all",
4 | "tabWidth": 2,
5 | "semi": true,
6 | "singleQuote": true
7 | }
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = tab
5 | end_of_line = lf
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [{package.json,*.yml}]
11 | indent_style = space
12 | indent_size = 2
13 |
--------------------------------------------------------------------------------
/test.js:
--------------------------------------------------------------------------------
1 | import test from 'ava';
2 | import alfyTest from 'alfy-test';
3 |
4 | test('alfred-keyboard', async (t) => {
5 | const alfy = alfyTest();
6 | const result = await alfy('r');
7 |
8 | t.deepEqual(result, [
9 | {
10 | title: 82,
11 | subtitle: 'r',
12 | },
13 | ]);
14 | });
15 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # alfred-keycode [](https://travis-ci.org/radibit/alfred-keycode)
2 |
3 | > Get JavaScript keycode
4 |
5 |
6 |
7 | ## Install
8 |
9 | ```
10 | $ npm install -g alfred-keycode
11 | ```
12 |
13 | _Requires [Node.js](https://nodejs.org) 14+ and the Alfred [Powerpack](https://www.alfredapp.com/powerpack/)._
14 |
15 | ## Usage
16 |
17 | In Alfred, type `kc`, Enter, and then press the requested key.
18 |
19 | For keys like Backspace, Tab, Ctrl etc. type their names.
20 |
21 | ## License
22 |
23 | MIT © [radibit](http://radibit.com)
24 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "alfred-keycode",
3 | "version": "0.3.0",
4 | "description": "Get JavaScript keycode",
5 | "license": "MIT",
6 | "repository": "radibit/alfred-keycode",
7 | "author": "Radimir Bitsov ",
8 | "type": "module",
9 | "engines": {
10 | "node": ">=14"
11 | },
12 | "scripts": {
13 | "test": "xo && ava",
14 | "postinstall": "alfy-init",
15 | "preuninstall": "alfy-cleanup"
16 | },
17 | "files": [
18 | "index.js",
19 | "icon.png",
20 | "info.plist"
21 | ],
22 | "keywords": [
23 | "alfred",
24 | "workflow",
25 | "keycode"
26 | ],
27 | "dependencies": {
28 | "alfred-notifier": "^0.2.3",
29 | "alfy": "^0.12.2"
30 | },
31 | "devDependencies": {
32 | "alfy-test": "^0.4.2",
33 | "ava": "^3.15.0",
34 | "xo": "^0.47.0"
35 | },
36 | "xo": {
37 | "prettier": true
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) radibit (radibit.com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | keycode
7 | bundleid
8 | com.radibit.alfred-keycode
9 | category
10 | Tools
11 | connections
12 |
13 | 2D0C453B-9484-4672-AAE8-069F14EB2DA0
14 |
15 |
16 | destinationuid
17 | 4E1B5CC6-BB18-45E7-AC17-41CC1450356A
18 | modifiers
19 | 0
20 | modifiersubtext
21 |
22 | vitoclose
23 |
24 |
25 |
26 |
27 | disabled
28 |
29 | objects
30 |
31 |
32 | config
33 |
34 | browser
35 |
36 | spaces
37 |
38 | url
39 | {query}
40 | utf8
41 |
42 |
43 | type
44 | alfred.workflow.action.openurl
45 | uid
46 | 4E1B5CC6-BB18-45E7-AC17-41CC1450356A
47 | version
48 | 1
49 |
50 |
51 | config
52 |
53 | alfredfiltersresults
54 |
55 | argumenttype
56 | 0
57 | escaping
58 | 102
59 | keyword
60 | kc
61 | queuedelaycustom
62 | 3
63 | queuedelayimmediatelyinitially
64 |
65 | queuedelaymode
66 | 0
67 | queuemode
68 | 2
69 | runningsubtext
70 | Searching...
71 | script
72 | ./node_modules/.bin/run-node index.js "$1"
73 | scriptargtype
74 | 1
75 | scriptfile
76 | index.js
77 | subtext
78 |
79 | title
80 | alfred-keycode
81 | type
82 | 0
83 | withspace
84 |
85 |
86 | type
87 | alfred.workflow.input.scriptfilter
88 | uid
89 | 2D0C453B-9484-4672-AAE8-069F14EB2DA0
90 | version
91 | 2
92 |
93 |
94 | readme
95 |
96 | uidata
97 |
98 | 4E1B5CC6-BB18-45E7-AC17-41CC1450356A
99 |
100 | xpos
101 | 150
102 | ypos
103 | 10
104 |
105 | 2D0C453B-9484-4672-AAE8-069F14EB2DA0
106 |
107 | xpos
108 | 10
109 | ypos
110 | 10
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import alfy from 'alfy';
2 |
3 | const keyCodes = [
4 | {
5 | title: 8,
6 | subtitle: 'backspace',
7 | },
8 | {
9 | title: 9,
10 | subtitle: 'tab',
11 | },
12 | {
13 | title: 13,
14 | subtitle: 'enter',
15 | },
16 | {
17 | title: 16,
18 | subtitle: 'shift',
19 | },
20 | {
21 | title: 17,
22 | subtitle: 'ctrl',
23 | },
24 | {
25 | title: 18,
26 | subtitle: 'alt',
27 | },
28 | {
29 | title: 19,
30 | subtitle: 'pause/break',
31 | },
32 | {
33 | title: 20,
34 | subtitle: 'caps lock',
35 | },
36 | {
37 | title: 27,
38 | subtitle: 'esc',
39 | },
40 | {
41 | title: 32,
42 | subtitle: 'space',
43 | },
44 | {
45 | title: 33,
46 | subtitle: 'page up',
47 | },
48 | {
49 | title: 34,
50 | subtitle: 'page down',
51 | },
52 | {
53 | title: 35,
54 | subtitle: 'end',
55 | },
56 | {
57 | title: 36,
58 | subtitle: 'home',
59 | },
60 | {
61 | title: 37,
62 | subtitle: 'left',
63 | },
64 | {
65 | title: 38,
66 | subtitle: 'up',
67 | },
68 | {
69 | title: 39,
70 | subtitle: 'right',
71 | },
72 | {
73 | title: 40,
74 | subtitle: 'down',
75 | },
76 | {
77 | title: 45,
78 | subtitle: 'insert',
79 | },
80 | {
81 | title: 46,
82 | subtitle: 'delete',
83 | },
84 | {
85 | title: 48,
86 | subtitle: '0',
87 | },
88 | {
89 | title: 49,
90 | subtitle: '1',
91 | },
92 | {
93 | title: 50,
94 | subtitle: '2',
95 | },
96 | {
97 | title: 51,
98 | subtitle: '3',
99 | },
100 | {
101 | title: 52,
102 | subtitle: '4',
103 | },
104 | {
105 | title: 53,
106 | subtitle: '5',
107 | },
108 | {
109 | title: 54,
110 | subtitle: '6',
111 | },
112 | {
113 | title: 55,
114 | subtitle: '7',
115 | },
116 | {
117 | title: 56,
118 | subtitle: '8',
119 | },
120 | {
121 | title: 57,
122 | subtitle: '9',
123 | },
124 | {
125 | title: 58,
126 | subtitle: ':',
127 | },
128 | {
129 | title: 60,
130 | subtitle: '<',
131 | },
132 | {
133 | title: 63,
134 | subtitle: 'ß',
135 | },
136 | {
137 | title: 65,
138 | subtitle: 'a',
139 | },
140 | {
141 | title: 66,
142 | subtitle: 'b',
143 | },
144 | {
145 | title: 67,
146 | subtitle: 'c',
147 | },
148 | {
149 | title: 68,
150 | subtitle: 'd',
151 | },
152 | {
153 | title: 69,
154 | subtitle: 'e',
155 | },
156 | {
157 | title: 70,
158 | subtitle: 'f',
159 | },
160 | {
161 | title: 71,
162 | subtitle: 'g',
163 | },
164 | {
165 | title: 72,
166 | subtitle: 'h',
167 | },
168 | {
169 | title: 73,
170 | subtitle: 'i',
171 | },
172 | {
173 | title: 74,
174 | subtitle: 'j',
175 | },
176 | {
177 | title: 75,
178 | subtitle: 'k',
179 | },
180 | {
181 | title: 76,
182 | subtitle: 'l',
183 | },
184 | {
185 | title: 77,
186 | subtitle: 'm',
187 | },
188 | {
189 | title: 78,
190 | subtitle: 'n',
191 | },
192 | {
193 | title: 79,
194 | subtitle: 'o',
195 | },
196 | {
197 | title: 80,
198 | subtitle: 'p',
199 | },
200 | {
201 | title: 81,
202 | subtitle: 'q',
203 | },
204 | {
205 | title: 82,
206 | subtitle: 'r',
207 | },
208 | {
209 | title: 83,
210 | subtitle: 's',
211 | },
212 | {
213 | title: 84,
214 | subtitle: 't',
215 | },
216 | {
217 | title: 85,
218 | subtitle: 'u',
219 | },
220 | {
221 | title: 86,
222 | subtitle: 'v',
223 | },
224 | {
225 | title: 87,
226 | subtitle: 'w',
227 | },
228 | {
229 | title: 88,
230 | subtitle: 'x',
231 | },
232 | {
233 | title: 89,
234 | subtitle: 'y',
235 | },
236 | {
237 | title: 90,
238 | subtitle: 'z',
239 | },
240 | {
241 | title: 91,
242 | subtitle: 'cmd',
243 | },
244 | {
245 | title: 91,
246 | subtitle: 'left cmd',
247 | },
248 | {
249 | title: 93,
250 | subtitle: 'right cmd',
251 | },
252 | {
253 | title: 106,
254 | subtitle: 'multiply',
255 | },
256 | {
257 | title: 107,
258 | subtitle: 'add',
259 | },
260 | {
261 | title: 109,
262 | subtitle: 'subtract',
263 | },
264 | {
265 | title: 110,
266 | subtitle: '.',
267 | },
268 | {
269 | title: 111,
270 | subtitle: 'divide',
271 | },
272 | {
273 | title: 144,
274 | subtitle: 'num lock',
275 | },
276 | {
277 | title: 145,
278 | subtitle: 'scroll lock',
279 | },
280 | {
281 | title: 160,
282 | subtitle: '^',
283 | },
284 | {
285 | title: 161,
286 | subtitle: '!',
287 | },
288 | {
289 | title: 163,
290 | subtitle: '#',
291 | },
292 | {
293 | title: 164,
294 | subtitle: '$',
295 | },
296 | {
297 | title: 165,
298 | subtitle: 'ù',
299 | },
300 | {
301 | title: 186,
302 | subtitle: ';',
303 | },
304 | {
305 | title: 187,
306 | subtitle: '=',
307 | },
308 | {
309 | title: 188,
310 | subtitle: ',',
311 | },
312 | {
313 | title: 189,
314 | subtitle: '-',
315 | },
316 | {
317 | title: 190,
318 | subtitle: '.',
319 | },
320 | {
321 | title: 191,
322 | subtitle: '/',
323 | },
324 | {
325 | title: 192,
326 | subtitle: '`',
327 | },
328 | {
329 | title: 219,
330 | subtitle: '[',
331 | },
332 | {
333 | title: 220,
334 | subtitle: '\\',
335 | },
336 | {
337 | title: 221,
338 | subtitle: ']',
339 | },
340 | {
341 | title: 222,
342 | subtitle: '"',
343 | },
344 | ];
345 |
346 | alfy.output(
347 | alfy.matches(alfy.input, keyCodes, (item, input) => item.subtitle === input),
348 | );
349 |
--------------------------------------------------------------------------------