Merge pull request #89 from iFanatical/xf86-keybind-enhancement-updated
Browse files
Xf86 keybind enhancement
+167 −7 src/keyboard/keysyms.rs
| @@ -76,7 +76,6 @@ pub const XK_COMMA: Keysym = 0x002c; | |||
| 76 | pub const XK_PERIOD: Keysym = 0x002e; | 76 | pub const XK_PERIOD: Keysym = 0x002e; |
| 77 | pub const XK_SLASH: Keysym = 0x002f; | 77 | pub const XK_SLASH: Keysym = 0x002f; |
| 78 | pub const XK_PRINT: Keysym = 0xff61; | 78 | pub const XK_PRINT: Keysym = 0xff61; |
| 79 | - | ||
| 80 | pub const XK_AMPERSAND: Keysym = 0x26; | 79 | pub const XK_AMPERSAND: Keysym = 0x26; |
| 81 | pub const XK_AGRAVE: Keysym = 0xe0; | 80 | pub const XK_AGRAVE: Keysym = 0xe0; |
| 82 | pub const XK_CCEDILLA: Keysym = 0xe7; | 81 | pub const XK_CCEDILLA: Keysym = 0xe7; |
| @@ -87,12 +86,65 @@ pub const XK_PARENRIGHT: Keysym = 0x29; | |||
| 87 | pub const XK_QUOTEDBL: Keysym = 0x22; | 86 | pub const XK_QUOTEDBL: Keysym = 0x22; |
| 88 | pub const XK_UNDERSCORE: Keysym = 0x5f; | 87 | pub const XK_UNDERSCORE: Keysym = 0x5f; |
| 89 | pub const XK_HYPHEN: Keysym = 0xad; | 88 | pub const XK_HYPHEN: Keysym = 0xad; |
| 90 | - | 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; | ||
| 91 | pub const XF86_AUDIO_RAISE_VOLUME: Keysym = 0x1008ff13; | 94 | pub const XF86_AUDIO_RAISE_VOLUME: Keysym = 0x1008ff13; |
| 92 | pub const XF86_AUDIO_LOWER_VOLUME: Keysym = 0x1008ff11; | 95 | pub const XF86_AUDIO_LOWER_VOLUME: Keysym = 0x1008ff11; |
| 93 | pub const XF86_AUDIO_MUTE: Keysym = 0x1008ff12; | 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; | ||
| 94 | pub const XF86_MON_BRIGHTNESS_UP: Keysym = 0x1008ff02; | 121 | pub const XF86_MON_BRIGHTNESS_UP: Keysym = 0x1008ff02; |
| 95 | pub const XF86_MON_BRIGHTNESS_DOWN: Keysym = 0x1008ff03; | 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; | ||
| 96 | 148 | ||
| 97 | pub fn keysym_from_str(s: &str) -> Option<Keysym> { | 149 | pub fn keysym_from_str(s: &str) -> Option<Keysym> { |
| 98 | match s { | 150 | match s { |
| @@ -181,11 +233,65 @@ pub fn keysym_from_str(s: &str) -> Option<Keysym> { | |||
| 181 | "QuoteDouble" => Some(XK_QUOTEDBL), | 233 | "QuoteDouble" => Some(XK_QUOTEDBL), |
| 182 | "Underscore" => Some(XK_UNDERSCORE), | 234 | "Underscore" => Some(XK_UNDERSCORE), |
| 183 | "Hyphen" => Some(XK_HYPHEN), | 235 | "Hyphen" => Some(XK_HYPHEN), |
| 184 | - "AudioRaiseVolume" => Some(XF86_AUDIO_RAISE_VOLUME), | 236 | + "AudioMedia" | "XF86AudioMedia" => Some(XF86_AUDIO_MEDIA), |
| 185 | - "AudioLowerVolume" => Some(XF86_AUDIO_LOWER_VOLUME), | 237 | + "XF86AudioNext" => Some(XF86_AUDIO_NEXT), |
| 186 | - "AudioMute" => Some(XF86_AUDIO_MUTE), | 238 | + "XF86AudioPause" => Some(XF86_AUDIO_PAUSE), |
| 187 | - "MonBrightnessUp" => Some(XF86_MON_BRIGHTNESS_UP), | 239 | + "XF86AudioPlay" => Some(XF86_AUDIO_PLAY), |
| 188 | - "MonBrightnessDown" => Some(XF86_MON_BRIGHTNESS_DOWN), | 240 | + "XF86AudioPrev" => Some(XF86_AUDIO_PREV), |
| 241 | + "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), | ||
| 189 | _ => None, | 295 | _ => None, |
| 190 | } | 296 | } |
| 191 | } | 297 | } |
| @@ -241,11 +347,65 @@ pub fn format_keysym(keysym: Keysym) -> String { | |||
| 241 | XK_QUOTEDBL => "\"".to_string(), | 347 | XK_QUOTEDBL => "\"".to_string(), |
| 242 | XK_UNDERSCORE => "_".to_string(), | 348 | XK_UNDERSCORE => "_".to_string(), |
| 243 | XK_HYPHEN => "-".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(), | ||
| 244 | XF86_AUDIO_RAISE_VOLUME => "Vol+".to_string(), | 355 | XF86_AUDIO_RAISE_VOLUME => "Vol+".to_string(), |
| 245 | XF86_AUDIO_LOWER_VOLUME => "Vol-".to_string(), | 356 | XF86_AUDIO_LOWER_VOLUME => "Vol-".to_string(), |
| 246 | XF86_AUDIO_MUTE => "Mute".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(), | ||
| 247 | XF86_MON_BRIGHTNESS_UP => "Bright+".to_string(), | 382 | XF86_MON_BRIGHTNESS_UP => "Bright+".to_string(), |
| 248 | XF86_MON_BRIGHTNESS_DOWN => "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(), | ||
| 249 | XK_A..=XK_Z => { | 409 | XK_A..=XK_Z => { |
| 250 | let ch = (keysym - XK_A + b'A' as u32) as u8 as char; | 410 | let ch = (keysym - XK_A + b'A' as u32) as u8 as char; |
| 251 | ch.to_string() | 411 | ch.to_string() |