tony / oxwm

Branch: e64975e
Switch branches/tags
master
emzywastaken add back previous `XF86AudioRaiseVolume` symbol 403913f 2025-12-22
419 lines · 16.2 KB Raw Blame History
1 #![allow(dead_code)]
2
3 pub type Keysym = u32;
4 pub const XK_ESCAPE: Keysym = 0xff1b;
5 pub const XK_RETURN: Keysym = 0xff0d;
6 pub const XK_SPACE: Keysym = 0x0020;
7 pub const XK_TAB: Keysym = 0xff09;
8 pub const XK_BACKSPACE: Keysym = 0xff08;
9 pub const XK_DELETE: Keysym = 0xffff;
10 pub const XK_F1: Keysym = 0xffbe;
11 pub const XK_F2: Keysym = 0xffbf;
12 pub const XK_F3: Keysym = 0xffc0;
13 pub const XK_F4: Keysym = 0xffc1;
14 pub const XK_F5: Keysym = 0xffc2;
15 pub const XK_F6: Keysym = 0xffc3;
16 pub const XK_F7: Keysym = 0xffc4;
17 pub const XK_F8: Keysym = 0xffc5;
18 pub const XK_F9: Keysym = 0xffc6;
19 pub const XK_F10: Keysym = 0xffc7;
20 pub const XK_F11: Keysym = 0xffc8;
21 pub const XK_F12: Keysym = 0xffc9;
22 pub const XK_A: Keysym = 0x0061;
23 pub const XK_B: Keysym = 0x0062;
24 pub const XK_C: Keysym = 0x0063;
25 pub const XK_D: Keysym = 0x0064;
26 pub const XK_E: Keysym = 0x0065;
27 pub const XK_F: Keysym = 0x0066;
28 pub const XK_G: Keysym = 0x0067;
29 pub const XK_H: Keysym = 0x0068;
30 pub const XK_I: Keysym = 0x0069;
31 pub const XK_J: Keysym = 0x006a;
32 pub const XK_K: Keysym = 0x006b;
33 pub const XK_L: Keysym = 0x006c;
34 pub const XK_M: Keysym = 0x006d;
35 pub const XK_N: Keysym = 0x006e;
36 pub const XK_O: Keysym = 0x006f;
37 pub const XK_P: Keysym = 0x0070;
38 pub const XK_Q: Keysym = 0x0071;
39 pub const XK_R: Keysym = 0x0072;
40 pub const XK_S: Keysym = 0x0073;
41 pub const XK_T: Keysym = 0x0074;
42 pub const XK_U: Keysym = 0x0075;
43 pub const XK_V: Keysym = 0x0076;
44 pub const XK_W: Keysym = 0x0077;
45 pub const XK_X: Keysym = 0x0078;
46 pub const XK_Y: Keysym = 0x0079;
47 pub const XK_Z: Keysym = 0x007a;
48 pub const XK_0: Keysym = 0x0030;
49 pub const XK_1: Keysym = 0x0031;
50 pub const XK_2: Keysym = 0x0032;
51 pub const XK_3: Keysym = 0x0033;
52 pub const XK_4: Keysym = 0x0034;
53 pub const XK_5: Keysym = 0x0035;
54 pub const XK_6: Keysym = 0x0036;
55 pub const XK_7: Keysym = 0x0037;
56 pub const XK_8: Keysym = 0x0038;
57 pub const XK_9: Keysym = 0x0039;
58 pub const XK_LEFT: Keysym = 0xff51;
59 pub const XK_UP: Keysym = 0xff52;
60 pub const XK_RIGHT: Keysym = 0xff53;
61 pub const XK_DOWN: Keysym = 0xff54;
62 pub const XK_HOME: Keysym = 0xff50;
63 pub const XK_END: Keysym = 0xff57;
64 pub const XK_PAGE_UP: Keysym = 0xff55;
65 pub const XK_PAGE_DOWN: Keysym = 0xff56;
66 pub const XK_INSERT: Keysym = 0xff63;
67 pub const XK_MINUS: Keysym = 0x002d;
68 pub const XK_EQUAL: Keysym = 0x003d;
69 pub const XK_LEFT_BRACKET: Keysym = 0x005b;
70 pub const XK_RIGHT_BRACKET: Keysym = 0x005d;
71 pub const XK_SEMICOLON: Keysym = 0x003b;
72 pub const XK_APOSTROPHE: Keysym = 0x0027;
73 pub const XK_GRAVE: Keysym = 0x0060;
74 pub const XK_BACKSLASH: Keysym = 0x005c;
75 pub const XK_COMMA: Keysym = 0x002c;
76 pub const XK_PERIOD: Keysym = 0x002e;
77 pub const XK_SLASH: Keysym = 0x002f;
78 pub const XK_PRINT: Keysym = 0xff61;
79 pub const XK_AMPERSAND: Keysym = 0x26;
80 pub const XK_AGRAVE: Keysym = 0xe0;
81 pub const XK_CCEDILLA: Keysym = 0xe7;
82 pub const XK_EGRAVE: Keysym = 0xe8;
83 pub const XK_EACUTE: Keysym = 0xe9;
84 pub const XK_PARENLEFT: Keysym = 0x28;
85 pub const XK_PARENRIGHT: Keysym = 0x29;
86 pub const XK_QUOTEDBL: Keysym = 0x22;
87 pub const XK_UNDERSCORE: Keysym = 0x5f;
88 pub const XK_HYPHEN: Keysym = 0xad;
89 pub const XF86_AUDIO_MEDIA: Keysym = 0x1008ff32;
90 pub const XF86_AUDIO_NEXT: Keysym = 0x1008ff17;
91 pub const XF86_AUDIO_PAUSE: Keysym = 0x1008ff31;
92 pub const XF86_AUDIO_PLAY: Keysym = 0x1008ff14;
93 pub const XF86_AUDIO_PREV: Keysym = 0x1008ff16;
94 pub const XF86_AUDIO_RAISE_VOLUME: Keysym = 0x1008ff13;
95 pub const XF86_AUDIO_LOWER_VOLUME: Keysym = 0x1008ff11;
96 pub const XF86_AUDIO_MUTE: Keysym = 0x1008ff12;
97 pub const XF86_AUDIO_MIC_MUTE: Keysym = 0x1008ffb2;
98 pub const XF86_AUDIO_RECORD: Keysym = 0x1008ff1c;
99 pub const XF86_AUDIO_REWIND: Keysym = 0x1008ff3e;
100 pub const XF86_AUDIO_STOP: Keysym = 0x1008ff15;
101 pub const XF86_BACK: Keysym = 0x1008ff26;
102 pub const XF86_CALCULATOR: Keysym = 0x1008ff1d;
103 pub const XF86_CLOSE: Keysym = 0x1008ff56;
104 pub const XF86_COPY: Keysym = 0x1008ff57;
105 pub const XF86_CUT: Keysym = 0x1008ff58;
106 pub const XF86_DOS: Keysym = 0x1008ff5a;
107 pub const XF86_DISPLAY: Keysym = 0x1008ff59;
108 pub const XF86_DOCUMENTS: Keysym = 0x1008ff5b;
109 pub const XF86_EJECT: Keysym = 0x1008ff2c;
110 pub const XF86_EXPLORER: Keysym = 0x1008ff5d;
111 pub const XF86_FAVORITES: Keysym = 0x1008ff30;
112 pub const XF86_FINANCE: Keysym = 0x1008ff3c;
113 pub const XF86_FORWARD: Keysym = 0x1008ff27;
114 pub const XF86_GAME: Keysym = 0x1008ff5e;
115 pub const XF86_GO: Keysym = 0x1008ff5f;
116 pub const XF86_HOME_PAGE: Keysym = 0x1008ff18;
117 pub const XF86_MAIL: Keysym = 0x1008ff19;
118 pub const XF86_MAIL_FORWARD: Keysym = 0x1008ff90;
119 pub const XF86_MENU_KB: Keysym = 0x1008ff65;
120 pub const XF86_MESSENGER: Keysym = 0x1008ff8e;
121 pub const XF86_MON_BRIGHTNESS_UP: Keysym = 0x1008ff02;
122 pub const XF86_MON_BRIGHTNESS_DOWN: Keysym = 0x1008ff03;
123 pub const XF86_MY_COMPUTER: Keysym = 0x1008ff33;
124 pub const XF86_NEW: Keysym = 0x1008ff68;
125 pub const XF86_NEXT_VMODE: Keysym = 0x1008fe22;
126 pub const XF86_PREV_VMODE: Keysym = 0x1008fe23;
127 pub const XF86_OPEN: Keysym = 0x1008ff6b;
128 pub const XF86_PASTE: Keysym = 0x1008ff6d;
129 pub const XF86_PHONE: Keysym = 0x1008ff6e;
130 pub const XF86_POWER_OFF: Keysym = 0x1008ff2a;
131 pub const XF86_RELOAD: Keysym = 0x1008ff73;
132 pub const XF86_REPLY: Keysym = 0x1008ff72;
133 pub const XF86_ROTATE_WINDOWS: Keysym = 0x1008ff74;
134 pub const XF86_SAVE: Keysym = 0x1008ff77;
135 pub const XF86_SCREEN_SAVER: Keysym = 0x1008ff2d;
136 pub const XF86_SCROLL_DOWN: Keysym = 0x1008ff79;
137 pub const XF86_SCROLL_UP: Keysym = 0x1008ff78;
138 pub const XF86_SEARCH: Keysym = 0x1008ff1b;
139 pub const XF86_SEND: Keysym = 0x1008ff7b;
140 pub const XF86_SHOP: Keysym = 0x1008ff36;
141 pub const XF86_SLEEP: Keysym = 0x1008ff2f;
142 pub const XF86_TASK_PANE: Keysym = 0x1008ff7f;
143 pub const XF86_TOOLS: Keysym = 0x1008ff81;
144 pub const XF86_WWW: Keysym = 0x1008ff2e;
145 pub const XF86_WAKE_UP: Keysym = 0x1008ff2b;
146 pub const XF86_WEBCAM: Keysym = 0x1008ff8f;
147 pub const XF86_XFER: Keysym = 0x1008ff8a;
148
149 pub fn keysym_from_str(s: &str) -> Option<Keysym> {
150 match s {
151 "Return" => Some(XK_RETURN),
152 "Escape" => Some(XK_ESCAPE),
153 "Space" => Some(XK_SPACE),
154 "Tab" => Some(XK_TAB),
155 "Backspace" => Some(XK_BACKSPACE),
156 "Delete" => Some(XK_DELETE),
157 "F1" => Some(XK_F1),
158 "F2" => Some(XK_F2),
159 "F3" => Some(XK_F3),
160 "F4" => Some(XK_F4),
161 "F5" => Some(XK_F5),
162 "F6" => Some(XK_F6),
163 "F7" => Some(XK_F7),
164 "F8" => Some(XK_F8),
165 "F9" => Some(XK_F9),
166 "F10" => Some(XK_F10),
167 "F11" => Some(XK_F11),
168 "F12" => Some(XK_F12),
169 "A" => Some(XK_A),
170 "B" => Some(XK_B),
171 "C" => Some(XK_C),
172 "D" => Some(XK_D),
173 "E" => Some(XK_E),
174 "F" => Some(XK_F),
175 "G" => Some(XK_G),
176 "H" => Some(XK_H),
177 "I" => Some(XK_I),
178 "J" => Some(XK_J),
179 "K" => Some(XK_K),
180 "L" => Some(XK_L),
181 "M" => Some(XK_M),
182 "N" => Some(XK_N),
183 "O" => Some(XK_O),
184 "P" => Some(XK_P),
185 "Q" => Some(XK_Q),
186 "R" => Some(XK_R),
187 "S" => Some(XK_S),
188 "T" => Some(XK_T),
189 "U" => Some(XK_U),
190 "V" => Some(XK_V),
191 "W" => Some(XK_W),
192 "X" => Some(XK_X),
193 "Y" => Some(XK_Y),
194 "Z" => Some(XK_Z),
195 "0" => Some(XK_0),
196 "1" => Some(XK_1),
197 "2" => Some(XK_2),
198 "3" => Some(XK_3),
199 "4" => Some(XK_4),
200 "5" => Some(XK_5),
201 "6" => Some(XK_6),
202 "7" => Some(XK_7),
203 "8" => Some(XK_8),
204 "9" => Some(XK_9),
205 "Left" => Some(XK_LEFT),
206 "Right" => Some(XK_RIGHT),
207 "Up" => Some(XK_UP),
208 "Down" => Some(XK_DOWN),
209 "Home" => Some(XK_HOME),
210 "End" => Some(XK_END),
211 "PageUp" => Some(XK_PAGE_UP),
212 "PageDown" => Some(XK_PAGE_DOWN),
213 "Insert" => Some(XK_INSERT),
214 "Minus" => Some(XK_MINUS),
215 "Equal" => Some(XK_EQUAL),
216 "BracketLeft" => Some(XK_LEFT_BRACKET),
217 "BracketRight" => Some(XK_RIGHT_BRACKET),
218 "Semicolon" => Some(XK_SEMICOLON),
219 "Apostrophe" => Some(XK_APOSTROPHE),
220 "Grave" => Some(XK_GRAVE),
221 "Backslash" => Some(XK_BACKSLASH),
222 "Comma" => Some(XK_COMMA),
223 "Period" => Some(XK_PERIOD),
224 "Slash" => Some(XK_SLASH),
225 "Print" => Some(XK_PRINT),
226 "Ampersand" => Some(XK_AMPERSAND),
227 "Agrave" => Some(XK_AGRAVE),
228 "Ccedilla" => Some(XK_CCEDILLA),
229 "Egrave" => Some(XK_EGRAVE),
230 "Eacute" => Some(XK_EACUTE),
231 "ParenLeft" => Some(XK_PARENLEFT),
232 "ParenRight" => Some(XK_PARENRIGHT),
233 "QuoteDouble" => Some(XK_QUOTEDBL),
234 "Underscore" => Some(XK_UNDERSCORE),
235 "Hyphen" => Some(XK_HYPHEN),
236 "AudioMedia" | "XF86AudioMedia" => Some(XF86_AUDIO_MEDIA),
237 "XF86AudioNext" => Some(XF86_AUDIO_NEXT),
238 "XF86AudioPause" => Some(XF86_AUDIO_PAUSE),
239 "XF86AudioPlay" => Some(XF86_AUDIO_PLAY),
240 "XF86AudioPrev" => Some(XF86_AUDIO_PREV),
241 "AudioRaiseVolume" | "XF86AudioRaiseVolume" => Some(XF86_AUDIO_RAISE_VOLUME),
242 "AudioLowerVolume" | "XF86AudioLowerVolume" => Some(XF86_AUDIO_LOWER_VOLUME),
243 "AudioMute" | "XF86AudioMute" => Some(XF86_AUDIO_MUTE),
244 "XF86AudioMicMute" => Some(XF86_AUDIO_MIC_MUTE),
245 "XF86AudioRecord" => Some(XF86_AUDIO_RECORD),
246 "XF86AudioRewind" => Some(XF86_AUDIO_REWIND),
247 "XF86AudioStop" => Some(XF86_AUDIO_STOP),
248 "XF86Back" => Some(XF86_BACK),
249 "XF86Calculator" => Some(XF86_CALCULATOR),
250 "XF86Close" => Some(XF86_CLOSE),
251 "XF86Copy" => Some(XF86_COPY),
252 "XF86Cut" => Some(XF86_CUT),
253 "XF86DOS" => Some(XF86_DOS),
254 "XF86Display" => Some(XF86_DISPLAY),
255 "XF86Documents" => Some(XF86_DOCUMENTS),
256 "XF86Eject" => Some(XF86_EJECT),
257 "XF86Explorer" => Some(XF86_EXPLORER),
258 "XF86Favorites" => Some(XF86_FAVORITES),
259 "XF86Finance" => Some(XF86_FINANCE),
260 "XF86Forward" => Some(XF86_FORWARD),
261 "XF86Game" => Some(XF86_GAME),
262 "XF86Go" => Some(XF86_GO),
263 "XF86HomePage" => Some(XF86_HOME_PAGE),
264 "XF86Mail" => Some(XF86_MAIL),
265 "XF86MailForward" => Some(XF86_MAIL_FORWARD),
266 "XF86MenuKB" => Some(XF86_MENU_KB),
267 "XF86Messenger" => Some(XF86_MESSENGER),
268 "MonBrightnessUp" | "XF86MonBrightnessUp" => Some(XF86_MON_BRIGHTNESS_UP),
269 "MonBrightnessDown" | "XF86MonBrightnessDown" => Some(XF86_MON_BRIGHTNESS_DOWN),
270 "XF86MyComputer" => Some(XF86_MY_COMPUTER),
271 "XF86New" => Some(XF86_NEW),
272 "XF86Next_VMode" => Some(XF86_NEXT_VMODE),
273 "XF86Prev_VMode" => Some(XF86_PREV_VMODE),
274 "XF86Open" => Some(XF86_OPEN),
275 "XF86Paste" => Some(XF86_PASTE),
276 "XF86Phone" => Some(XF86_PHONE),
277 "XF86PowerOff" => Some(XF86_POWER_OFF),
278 "XF86Reload" => Some(XF86_RELOAD),
279 "XF86Reply" => Some(XF86_REPLY),
280 "XF86RotateWindows" => Some(XF86_ROTATE_WINDOWS),
281 "XF86Save" => Some(XF86_SAVE),
282 "XF86ScreenSaver" => Some(XF86_SCREEN_SAVER),
283 "XF86ScrollDown" => Some(XF86_SCROLL_DOWN),
284 "XF86ScrollUp" => Some(XF86_SCROLL_UP),
285 "XF86Search" => Some(XF86_SEARCH),
286 "XF86Send" => Some(XF86_SEND),
287 "XF86Shop" => Some(XF86_SHOP),
288 "XF86Sleep" => Some(XF86_SLEEP),
289 "XF86TaskPane" => Some(XF86_TASK_PANE),
290 "XF86Tools" => Some(XF86_TOOLS),
291 "XF86WWW" => Some(XF86_WWW),
292 "XF86WakeUp" => Some(XF86_WAKE_UP),
293 "XF86WebCam" => Some(XF86_WEBCAM),
294 "XF86Xfer" => Some(XF86_XFER),
295 _ => None,
296 }
297 }
298
299 pub fn format_keysym(keysym: Keysym) -> String {
300 match keysym {
301 XK_RETURN => "Return".to_string(),
302 XK_ESCAPE => "Esc".to_string(),
303 XK_SPACE => "Space".to_string(),
304 XK_TAB => "Tab".to_string(),
305 XK_BACKSPACE => "Backspace".to_string(),
306 XK_DELETE => "Del".to_string(),
307 XK_LEFT => "Left".to_string(),
308 XK_RIGHT => "Right".to_string(),
309 XK_UP => "Up".to_string(),
310 XK_DOWN => "Down".to_string(),
311 XK_HOME => "Home".to_string(),
312 XK_END => "End".to_string(),
313 XK_PAGE_UP => "PgUp".to_string(),
314 XK_PAGE_DOWN => "PgDn".to_string(),
315 XK_INSERT => "Ins".to_string(),
316 XK_F1 => "F1".to_string(),
317 XK_F2 => "F2".to_string(),
318 XK_F3 => "F3".to_string(),
319 XK_F4 => "F4".to_string(),
320 XK_F5 => "F5".to_string(),
321 XK_F6 => "F6".to_string(),
322 XK_F7 => "F7".to_string(),
323 XK_F8 => "F8".to_string(),
324 XK_F9 => "F9".to_string(),
325 XK_F10 => "F10".to_string(),
326 XK_F11 => "F11".to_string(),
327 XK_F12 => "F12".to_string(),
328 XK_SLASH => "/".to_string(),
329 XK_COMMA => ",".to_string(),
330 XK_PERIOD => ".".to_string(),
331 XK_MINUS => "-".to_string(),
332 XK_EQUAL => "=".to_string(),
333 XK_GRAVE => "`".to_string(),
334 XK_LEFT_BRACKET => "[".to_string(),
335 XK_RIGHT_BRACKET => "]".to_string(),
336 XK_SEMICOLON => ";".to_string(),
337 XK_APOSTROPHE => "'".to_string(),
338 XK_BACKSLASH => "\\".to_string(),
339 XK_PRINT => "Print".to_string(),
340 XK_AMPERSAND => "&".to_string(),
341 XK_AGRAVE => "à".to_string(),
342 XK_CCEDILLA => "ç".to_string(),
343 XK_EGRAVE => "è".to_string(),
344 XK_EACUTE => "é".to_string(),
345 XK_PARENLEFT => "(".to_string(),
346 XK_PARENRIGHT => ")".to_string(),
347 XK_QUOTEDBL => "\"".to_string(),
348 XK_UNDERSCORE => "_".to_string(),
349 XK_HYPHEN => "-".to_string(),
350 XF86_AUDIO_MEDIA => "Media".to_string(),
351 XF86_AUDIO_NEXT => "Next".to_string(),
352 XF86_AUDIO_PAUSE => "Pause".to_string(),
353 XF86_AUDIO_PLAY => "Play".to_string(),
354 XF86_AUDIO_PREV => "Prev".to_string(),
355 XF86_AUDIO_RAISE_VOLUME => "Vol+".to_string(),
356 XF86_AUDIO_LOWER_VOLUME => "Vol-".to_string(),
357 XF86_AUDIO_MUTE => "Mute".to_string(),
358 XF86_AUDIO_MIC_MUTE => "MicMute".to_string(),
359 XF86_AUDIO_RECORD => "Record".to_string(),
360 XF86_AUDIO_REWIND => "Rewind".to_string(),
361 XF86_AUDIO_STOP => "Stop".to_string(),
362 XF86_BACK => "Back".to_string(),
363 XF86_CALCULATOR => "Calculator".to_string(),
364 XF86_CLOSE => "Close".to_string(),
365 XF86_COPY => "Copy".to_string(),
366 XF86_CUT => "Cut".to_string(),
367 XF86_DOS => "DOS".to_string(),
368 XF86_DISPLAY => "Display".to_string(),
369 XF86_DOCUMENTS => "Documents".to_string(),
370 XF86_EJECT => "Eject".to_string(),
371 XF86_EXPLORER => "Explorer".to_string(),
372 XF86_FAVORITES => "Favorites".to_string(),
373 XF86_FINANCE => "Finance".to_string(),
374 XF86_FORWARD => "Forward".to_string(),
375 XF86_GAME => "Game".to_string(),
376 XF86_GO => "Go".to_string(),
377 XF86_HOME_PAGE => "HomePage".to_string(),
378 XF86_MAIL => "Mail".to_string(),
379 XF86_MAIL_FORWARD => "MailForward".to_string(),
380 XF86_MENU_KB => "MenuKB".to_string(),
381 XF86_MESSENGER => "Messenger".to_string(),
382 XF86_MON_BRIGHTNESS_UP => "Bright+".to_string(),
383 XF86_MON_BRIGHTNESS_DOWN => "Bright-".to_string(),
384 XF86_MY_COMPUTER => "MyComputer".to_string(),
385 XF86_NEW => "New".to_string(),
386 XF86_NEXT_VMODE => "NextVMode".to_string(),
387 XF86_PREV_VMODE => "PrevVMode".to_string(),
388 XF86_OPEN => "Open".to_string(),
389 XF86_PASTE => "Paste".to_string(),
390 XF86_PHONE => "Phone".to_string(),
391 XF86_POWER_OFF => "PowerOff".to_string(),
392 XF86_RELOAD => "Reload".to_string(),
393 XF86_REPLY => "Reply".to_string(),
394 XF86_ROTATE_WINDOWS => "RotateWindows".to_string(),
395 XF86_SAVE => "Save".to_string(),
396 XF86_SCREEN_SAVER => "ScreenSaver".to_string(),
397 XF86_SCROLL_DOWN => "ScrollDown".to_string(),
398 XF86_SCROLL_UP => "ScrollUp".to_string(),
399 XF86_SEARCH => "Search".to_string(),
400 XF86_SEND => "Send".to_string(),
401 XF86_SHOP => "Shop".to_string(),
402 XF86_SLEEP => "Sleep".to_string(),
403 XF86_TASK_PANE => "TaskPane".to_string(),
404 XF86_TOOLS => "Tools".to_string(),
405 XF86_WWW => "WWW".to_string(),
406 XF86_WAKE_UP => "WakeUp".to_string(),
407 XF86_WEBCAM => "WebCam".to_string(),
408 XF86_XFER => "Xfer".to_string(),
409 XK_A..=XK_Z => {
410 let ch = (keysym - XK_A + b'A' as u32) as u8 as char;
411 ch.to_string()
412 }
413 XK_0..=XK_9 => {
414 let ch = (keysym - XK_0 + b'0' as u32) as u8 as char;
415 ch.to_string()
416 }
417 _ => format!("0x{:x}", keysym),
418 }
419 }