8

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.

  • Does this happen all the time? Was Chrome open when you were experiencing this? – rtaft Jun 17 '19 at 13:29
  • @rtaft - yes, this happens all the time. I've rebooted multiple times and tried to use set and use the play/pause after logging in but it does not work. – Dave Rolsky Jun 24 '19 at 01:07
  • Did you try a cold boot? – WinEunuuchs2Unix Jun 24 '19 at 01:47
  • Are events from the keyboard still arriving? Can you check with something like xev? – Sebastian Stark Jun 25 '19 at 16:30
  • @SebastianStark - yes, I see the events in xev. I can even set the keys as a shortcut in the gnome keyboard settings applet but the play/pause doesn't work once it's set. – Dave Rolsky Jun 25 '19 at 21:54
  • stupid question perhaps, but have you checked the num lock / scroll lock status? Not sure if those have any influence on the media keys – Sebastian Stark Jun 26 '19 at 16:52
  • @SebastianStark - I just checked but neither seems to affect whether the play/pause key works. – Dave Rolsky Jun 27 '19 at 04:25
  • Go to a console by pressing [Ctrl][Alt][F3] and type showkey --keycodes then press the mute, play, prev, next and mute back again and leave a comment @Fabby with the result. – Fabby Jun 29 '19 at 02:01
  • @Fabby - Here's the output: https://gist.github.com/autarch/ae1c0f245708b84227fc07ff99474c9c

    I assume 28 is the release of enter.

    – Dave Rolsky Jun 30 '19 at 18:20
  • That's good news! Now gsettings list-recursively org.gnome.settings-daemon.plugins.media-keys Can you still get into chat with the rep you've got left? – Fabby Jun 30 '19 at 18:56
  • @Fabby - https://gist.github.com/autarch/e86996e3fe69a53edd09c3de2a5dca5d

    And yes, I can join chat.

    – Dave Rolsky Jun 30 '19 at 23:35
  • 01:52 here. Join now and ping me @Fabby! – Fabby Jun 30 '19 at 23:52

2 Answers2

5

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.

Fabby
  • 34,259
  • That did it! Thanks! – Dave Rolsky Jul 01 '19 at 03:07
  • Although I should note that my prev, next, and mute keys had kept working. This broke them but fixed play/pause. Then I went back into the keyboard settings and rebound the prev, next, & mute keys and now it all works. WTF, gnome. – Dave Rolsky Jul 01 '19 at 03:09
  • That's why I wanted you in chat. @DaveRolsky :-) Happy to help, thanks for the upvote and acceptance, don't forget to award the bounty as otherwise I only get half. ;-) – Fabby Jul 01 '19 at 07:55
  • So play/pause has stopped working again after a recent reboot and now this fix no longer solves it. Why, gnome, why? – Dave Rolsky Sep 03 '19 at 14:26
  • And now it's working again after yet another reboot. W. T. F. – Dave Rolsky Sep 03 '19 at 14:45
  • These commands give me errors: expected value: (empty input) ^ – colan Jan 31 '20 at 22:53
  • @colan I'm not on Ubuntu any more: Please ask a new question and refer to this question in your new one after you've copy-pasted the exact command... – Fabby Feb 02 '20 at 16:11
3

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.

luopio
  • 131
  • Would be cleaner with a systemctl restart --user gsd-media-keys kind of command but couldn't get it working since it's only started via dependencies. – luopio Apr 21 '20 at 08:14