diff --git a/.changes/linux-global-shortcut.md b/.changes/linux-global-shortcut.md new file mode 100644 index 000000000..706ff5d7e --- /dev/null +++ b/.changes/linux-global-shortcut.md @@ -0,0 +1,5 @@ +--- +"tao": "patch" +--- + +On Linux, fix global shortcut are never triggered when a Lock key is ON, eg. NumLock, CapsLock ...etc \ No newline at end of file diff --git a/src/platform_impl/linux/global_shortcut.rs b/src/platform_impl/linux/global_shortcut.rs index e6b4f6e0e..52fa3f1a8 100644 --- a/src/platform_impl/linux/global_shortcut.rs +++ b/src/platform_impl/linux/global_shortcut.rs @@ -62,7 +62,9 @@ impl ShortcutManager { (xlib.XNextEvent)(display, &mut event); if let xlib::KeyRelease = event.get_type() { let keycode = event.key.keycode; - let modifiers = event.key.state; + // X11 sends masks for Lock keys also and we only care about the 4 below + let modifiers = event.key.state + & (xlib::ControlMask | xlib::ShiftMask | xlib::Mod4Mask | xlib::Mod1Mask); if let Some(hotkey_id) = hotkey_map.lock().unwrap().get(&(keycode as i32, modifiers)) { event_loop_channel