Media play/pause & track prev/next stopped working after reboot

I'm on Ubuntu 18.04 using a Das Keyboard 4. After a reboot today three of my media keys stopped working, the pause/play key and the prev/next track keys.

However, the mute key and the volume wheel still work.

I tried the following things with no success:

  • Going into the keyboards shortcuts settings and setting the keys for these shortcuts explicitly. It does seem to register the keypress but setting or clearing the shortcut doesn't help.
  • Messing around in dconf-editor per discussion in Media Keys not working on Ubuntu 17.10 - I tried clearing the setting for these shortcuts entirely and that did nothing.
  • I tried creating a custom shortcut to run dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause per that same discussion, but I cannot associate it with the pause/play key from the keyboard shortcuts app. When I try to set the shortcut for this custom command it simply doesn't register the pause/play key being pressed. If I bind it to Ctrl+Alt+Shift+P it does work (but I want my media keys!).

This is incredibly annoying. If anyone has any idea how to fix it I'd be greatly appreciative.


Solution 1:

Do the following:

gsettings set org.gnome.settings-daemon.plugins.media-keys previous ''
gsettings set org.gnome.settings-daemon.plugins.media-keys next ''
gsettings set org.gnome.settings-daemon.plugins.media-keys volume-mute ''

and then try again as the keys won't be trapped any more so Gnome can do whatever it wants with them.

If one of the keys stops working, rebind it in Keyboard settings.

Solution 2:

Here's my solution on Ubuntu 19.10 with media keys working after a clean reboot, but not after resuming from sleep, etc.

Restarting gsd-media-keys in Terminal:

killall gsd-media-keys
/usr/lib/gnome-settings-daemon/gsd-media-keys

You might want to run the latter command with the run dialog (Alt + F2) because it will start in the foreground.