Skip to content

Commit

Permalink
fix(linux/globalShorcut): extract needed mods from event state, closes
Browse files Browse the repository at this point in the history
…#307, closes #537 (#538)

* fix(linux/globalShorcut): extract needed mods from event state, closes #307, closes #537

* remove a stray `=`
  • Loading branch information
amrbashir committed Aug 19, 2022
1 parent 7d2eeee commit 07e3c1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .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
4 changes: 3 additions & 1 deletion src/platform_impl/linux/global_shortcut.rs
Expand Up @@ -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
Expand Down

0 comments on commit 07e3c1f

Please sign in to comment.