-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: mapping media keys does not work (MediaPlayPause
, MediaTrackNext
etc.)
#1233
Comments
MediaPlayPause
, MediaNextSong
etc.) MediaPlayPause
, MediaTrackNext
etc.)
If it's not showing in debug logs I think it might not be interceptable via the llhook mechanism, likely Windows OS doesn't pass it along. |
Does this mean it may require using some other mechanism or OS APIs that apps like Spotify or Chromium use to hook into the media keys on Windows? |
My guess would be that apps can receive it as the focused window but background tasks can't receive it. That's what hooks are for; to allow background task to intercept and modify before reaching focused app. But if it doesn't work in hooks then likely not much option. I suppose we could see if rawinput might work. |
I looked into this, it appears on Windows (or at least starting with Windows 10), media keys can not be intercepted with regular global key hooks*, if I understood correctly, Windows has an API called Media Transport Controls (MTC), applications like media players or browsers that want to handle these events must register explicitly with MTC to receive them. I don't think this API allows hooking into key events for media keys like key down or up, which Kanata requires for some of its features like triggering fake/virtual keys on key release or as soon as a key is pressed, so if you would want to add support for binding to media key presses on Windows*, I don't think media key mappings would/can support all the features of Kanata. *(I mean without/besides using the Interception driver/mechanism) Edit: it appears |
Thanks for doing the research! |
I thought I should make it known that I just tested the interception variant of Kanata and still the debug logs do not show any logs* to indicate that Kanata detects that a media key is pressed or released. *logs like these:
|
Requirements
Describe the bug
I'm trying to remap the functionality of the media keys on my keyboard and my headphones:
The first 3 mappings work as expected, the next 3 don't. pressing the key does not even show that you pressed it in the
--debug
logs in Kanata's output.Relevant kanata config
⬆️
To Reproduce
MediaPlayPause
,MediaTrackNext
orMediaTrackNextPrevious
in your Kanata config--debug
logs outputExpected behavior
Media keys to do what I map them to when I press them.
Kanata version
kanata 1.7.0-prerelease-1 (last commit as of now 7adab8a )
Debug logs
Kanata does not output debug logs when I press down or release a media key. like it does for other keys.
Operating system
Windows 11
Additional context
cargo build --features win_sendinput_send_scancodes,win_llhook_read_scancodes --release
(llhook, not interception)
MediaPlayPause
,MediaTrackNext
,MediaTrackPrevious
).cargo build --release
, and it behaves the same, so the issue is not specific to those feature flags.The text was updated successfully, but these errors were encountered: