Closed Bug 1584030 Opened 5 years ago Closed 5 years ago

Implement global media keys on Linux

Categories

(Core :: Widget: Gtk, task, P2)

Unspecified
Linux
task

Tracking

()

RESOLVED DUPLICATE of bug 1353652

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.

I can take this on.

(In reply to paul.eliot.warner from comment #1)

I can take this on.

Sure, feel free to take it, thank you!

See Also: → 1353652

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

Summary: Support hardware media keys on Linux → Implement global media keys on Linux

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.

Component: Audio/Video: Playback → Widget: Gtk
Depends on: 1591288

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).

No longer blocks: webext-commands-global

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.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.