Keyboard volume buttons not working in Gnome

I have a NixOS 20.09 install using Gnome:

services.xserver.desktopManager.gnome3.enable = true;

I use a super-basic keyboard from an old PC and it has volume up/down and mute buttons. These work out of the box on my Solus machine running Gnome. But I can’t seem to get them to work in NixOS.

Doing some searching I found sound.mediaKeys although the docs say they shouldn’t be necessary if you’re running Gnome. Here’s my entire sound section of my conf:

sound.enable = true;
sound.mediaKeys.enable = true;
hardware.pulseaudio.enable = true;
services.jack.jackd.enable = false;
services.jack.alsa.enable = false;

(I had trouble with the Jack stuff and haven’t gotten back to it.)

Anyone have any other suggestions? Since it’s working on the Solus box maybe there’s something I can check there?

Thanks in advance…

Media keys should work out of the box but in case they do not for some reason, you can go to Keyboard Shortcuts panel in GNOME Settings and try to associate the volume controls manually.

Hm, if I go into Keyboard Shortcuts and select “Volume mute” for example, pressing the mute button doesn’t appear to do anything… the Set Shortcut modal just sits there. Perhaps this only works for setting shortcuts like a key combination? That or maybe there’s some problem in USB land and the keypress just isn’t sending? Oh, I remember using some app to check keypresses before… I’ll try to find that again.

Either xev or sudo libinput debug-events --show-keycodes should do.

2 Likes

Rats. No output for these keys with libinput on either machine… and I’m not following how xev helps with this. Will have to read up more on it later.

I remember seeing something about checking these keys with dconf but didn’t follow it. You wouldn’t happen to know how to use that tool?

IIRC xev shows events that X server (or maybe the client) sees.
libinput should work on even lower level so if it does not see them,
xev probably will not either.

dconf is a database for storing configuration values (think Windows
registry) that is used by apps and other user-facing GNOME components
so it will not help you.

I would first make sure sound.mediaKeys.enable is false in case
actkbd somehow masks the keys.