Bug#1071717: gnome-settings-daemon: gsd-media-keys fires D-Bus MPris PlayPause message randomly

Simon McVittie smcv at debian.org
Fri May 24 09:52:54 BST 2024


On Fri, 24 May 2024 at 10:08:28 +0300, Andres Gomez Garcia wrote:
> I've some keyboard key combination mapped for doing the PlayPause
> action.
> 
> Rarely, when I'm using the headphones for other use than music, for
> example, attending a confcall, the music playback is activated
> randomly.

This is expected to happen if your headphones have a play/pause button,
their Linux kernel driver maps it as a partial keyboard, and the
headphones send the keycode for a play/pause multimedia key
(XF86AudioPlay).

Typically wireless headphones have 3 buttons which are mapped as
a partial keyboard with play/pause, volume up and volume down keys
(internally XF86AudioPlay, XF86AudioRaiseVolume, XF86AudioLowerVolume).

Depending on how your USB dongle works, it might identify itself as a
generic USB keyboard with these keys and others, in which case it would
be indistinguishable from a real keyboard; or it might identify itself
as a more specific device.

> The sender is gsd-media-keys

It sends MPRIS PlayPause in response to a keyboard event reporting either
your configured key combination, or the dedicated play/pause multimedia key.

gsd-media-keys intentionally recognises the multimedia key even if a
different keyboard key combination has also been configured, because that's
necessary to make typical Bluetooth headphones work as expected.

> Oddly enough, this happens more often when using some wireless
> headphones (no bluetooth, but with a proprietary USB dongle
> transmitter) and I'm far from the computer.

This sounds as though your USB dongle might be falsely reporting button
presses when the wireless link to the headphones is at the limits of its
range. If that's the case, then there is nothing that gsd-media-keys
will be able to do about this: it can't tell the difference between a
real button press and a spurious one.

A workaround would be to use dconf-editor or gsettings(1) to unconfigure
the static/hard-coded binding for XF86AudioPlay:

    gsettings set org.gnome.settings-daemon.plugins.media-keys play-static '[]'

Please try that and see whether it avoids this problem?

This will prevent correctly-functioning wireless headphones
(e.g. Bluetooth) from controlling play/pause as they are intended to be
able to do, and will also prevent recognition of a dedicated play/pause
key that is available on some USB or wireless keyboards, so only use
that workaround long-term if that is acceptable collateral damage. You
can undo the workaround if it is no longer desirable with:

    gsettings reset org.gnome.settings-daemon.plugins.media-keys play-static

I don't think the various -static bindings are configurable in the UI,
because reconfiguring them breaks intended functionality of hardware
that is working correctly.

    smcv



More information about the pkg-gnome-maintainers mailing list