lidel / google-music-hotkeys

Browser extension that adds keyboard control to Google / YouTube Music
https://github.com/lidel/google-music-hotkeys#install
Creative Commons Zero v1.0 Universal
32 stars 5 forks source link

MediaPlayPause has second binding #9

Closed randm-ch closed 5 years ago

randm-ch commented 6 years ago

I have set MediaPlayPause for Toggle Playback in the Addon Options. Works great, thanks! But the playback is also toggled when I hit the [^] key (Swiss-German keyboard layout, that's the key just left of Backspace). Can I disable this?

lidel commented 6 years ago

I don't think this is related to extension itself.

What operating system are you using? It sounds like either OS or some other app running on it is hijacking ^ key, or your hardware keyboard has function keys that get triggered somehow.

randm-ch commented 6 years ago

I'm on Linux. I have tested this with both Arch and Ubuntu. It has something to do with the keyboard itself because the problem only occurs when I use my external keyboard, but not the one built in the laptop. Very strange but this indeed doesn't seem to be an issue with the extension. Closed. Thank you!

randm-ch commented 6 years ago

@lidel I just tested this again on another laptop (Ubuntu with GNOME) with no external keyboard. I have set:

^ toggles Playback (when focus is not in an input field) on this machine, and so do MediaPrevTrack and MediaNextTrack (they don't skip to the next/previous song). So it's not just the external keyboard.

Any idea what I might be doing wrong? I have unassigned the media keys in the Keyboard settings (otherwise it doesn't work at all). No other media player is runing, or even installed. I have disabled all other FF addons. FF version is 60.0.2. Thanks!

lidel commented 6 years ago

@randm-ch tough cookie! :thinking:

Are you running the latest version of extension (1.6.0) and unchecked modifiers like on screenshot below?

If so, I guess we need to do step-by-step elimination.

First, let's make sure X11 is getting proper keyboard events:

  1. install and start xev -event keyboard tool in terminal
  2. move mouse/focus to its white window
  3. press ^
  4. copy console output and paste here
  5. repeat for MediaPrevTrack and MediaNextTrack

On my machine pressing and releasing ^ produces 2 events:

KeyPress event, serial 28, synthetic NO, window 0x2800001,
    root 0xe3, subw 0x0, time 625073729, (460,699), root:(2757,702),
    state 0x1, keycode 15 (keysym 0x5e, asciicircum), same_screen YES,
    XLookupString gives 1 bytes: (5e) "^"
    XmbLookupString gives 1 bytes: (5e) "^"
    XFilterEvent returns: False

KeyRelease event, serial 28, synthetic NO, window 0x2800001,
    root 0xe3, subw 0x0, time 625073879, (460,699), root:(2757,702),
    state 0x1, keycode 15 (keysym 0x5e, asciicircum), same_screen YES,
    XLookupString gives 1 bytes: (5e) "^"
    XFilterEvent returns: False

MediaPrevTrack and MediaNextTrack should produce similar events, but with key names XF86AudioPrev and XF86AudioNext.

randm-ch commented 6 years ago

^

KeyPress event, serial 34, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90604340, (98,95), root:(188,308),
    state 0x10, keycode 21 (keysym 0xfe52, dead_circumflex), same_screen YES,
    XLookupString gives 1 bytes: (5e) "^"
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyRelease event, serial 37, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90604660, (98,95), root:(188,308),
    state 0x10, keycode 21 (keysym 0xfe52, dead_circumflex), same_screen YES,
    XLookupString gives 1 bytes: (5e) "^"
    XFilterEvent returns: False

MediaPlayPause

KeyPress event, serial 37, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90619108, (2567,1133), root:(2657,1346),
    state 0x10, keycode 172 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyRelease event, serial 38, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90619196, (2567,1133), root:(2657,1346),
    state 0x10, keycode 172 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MediaPrevTrack

KeyPress event, serial 38, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90620644, (2567,1133), root:(2657,1346),
    state 0x10, keycode 173 (keysym 0x1008ff16, XF86AudioPrev), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90620772, (2567,1133), root:(2657,1346),
    state 0x10, keycode 173 (keysym 0x1008ff16, XF86AudioPrev), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MediaNextTrack

KeyPress event, serial 38, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90621756, (2567,1133), root:(2657,1346),
    state 0x10, keycode 171 (keysym 0x1008ff17, XF86AudioNext), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x3e00001,
    root 0x1a8, subw 0x0, time 90621868, (2567,1133), root:(2657,1346),
    state 0x10, keycode 171 (keysym 0x1008ff17, XF86AudioNext), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Looks good, right? Extension version is 1.6.0. I'm running a GNOME 3.28.1 X11 session.

lidel commented 6 years ago

Ok, this part looks as expected, which means something is hijacking or miss-representing ^ event after it is received by X11.

Do you experience the same bug when you change keyboard layout to English (US) ?

randm-ch commented 6 years ago

@lidel ^ (= with English (US) layout) doesn't trigger play/pause, but MediaPrevTrack and MediaNextTrack still do...

lidel commented 6 years ago

Ok, sounds like something specific to Ubuntu/DE. Sadly I don't have Ubuntu on my hands, but perhaps below helps?

randm-ch commented 5 years ago

@lidel I'm back on Arch and the issue persists. So either it's GNOME related or I'm just really unlucky ;) But I think as long as noone else has the same issue it's not worth investigating and I can live with it. Thanks for your time!