Implement global media keys on Linux
Categories
(Core :: Widget: Gtk, task, P2)
Tracking
()
People
(Reporter: alwu, Unassigned)
References
Details
We would like to support hardware media keys, such like play/pause, prev and next, to control media playback on Linux.
Comment 1•5 years ago
|
||
I can take this on.
Reporter | ||
Comment 2•5 years ago
|
||
(In reply to paul.eliot.warner from comment #1)
I can take this on.
Sure, feel free to take it, thank you!
Reporter | ||
Comment 3•5 years ago
|
||
According to bug1584029 comment8, we can receive normal media keys from NSTextInputClient
protocal, but it only works when Firefox is in the foreground (on focus).
But for media keys, we would like to use them to control media even if Firefox is not on focus. So we should use xgrabkey()
[1] to capture them, like what Chrome did here [2].
[1] https://linux.die.net/man/3/xgrabkey
[2] https://cs.chromium.org/chromium/src/chrome/browser/extensions/global_shortcut_listener_x11.cc?l=102-130
Reporter | ||
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Note that there's also a dbus API for registering interest in media keys.
https://github.com/GNOME/gnome-settings-daemon/tree/master/plugins/media-keys
This is probably friendlier than xgrabkey on desktops that use this.
Reporter | ||
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Actually we shouldn't need XGrabKey as MPRIS should replace this while even providing more functionality.
This would only make sense if MPRIS wasn't supported. Platforms which don't run the DBUS, mainly. But I don't know if we even support that?
Anyway it is closely related to bug1353652
Depending on whether we want XGrabKey as a fallback, this bug is a duplicate (dependant) on bug1353652 or not.
If we want XGrabKey as a fallback, this should/would be implemented as bug1583858 (or whatever the web extension global hotkey support now is), but closely keeping an eye on not producing double events (one through the global hotkey implementation and one through MPRIS).
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 6•5 years ago
|
||
Your're right, this one should be a duplication of bug1353652. If most Linux platform can handle media key directly and transfer them to MPRIS-based commands, I don't think we should have to implement XGrabKey
at least for now.
Description
•