HP Dev One - KB Sound Controls

Hi,

I have NixOS (sway + wayland) running on a HP Dev One, the sound works, and I can control it using amixer. The issue is I am unable to control the sound volume using the keys on the laptop.

Within /etc/nixos/configuration.nix there are the following lines:

sound.enable = true;
sound.mediaKeys.enable = true;

Enabling sound.mediaKeys did not result in functional sound control keys. I then found out what key identifiers map to the sound control keys and added them to services.actkbd.bindings.

The brightness control keys are setup in the same fashion, and work correctly.

However, the sound control keys still do not work. I can run the commands (without sudo) in a terminal and they do indeed control the sound. I am at a loss to what to try next, any help would be appreciated :slight_smile:

services.actkbd = {
    enable = true;
    bindings = [
      { keys = [ 224 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -U 10"; }
      { keys = [ 225 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -A 10"; }
      { keys = [ 113 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/amixer -q set Master toggle"; }
      { keys = [ 115 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/amixer -q set Master 5%+"; }
      { keys = [ 114 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/amixer -q set Master 5%-"; }
    ];
  };

I removed the use of actkbd and added the following lines to .config/sway/config as another method of controlling volume and screen brightness.

bindsym XF86AudioMicMute exec 'pactl set-source-mute @DEFAULT_SOURCE@ toggle'
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'

As I am using pipewire, I also removed sound.enable = true; from /etc/nixos/configuation.nix and now my keys work. All that is left is to fix the mic mute button as that’s not working.

I encountered a similar issue with the mic mute button on an HP Dev One and submitted: NixOS PR#227499. If you’re still having an issue, please feel free to review the PR. You can subscribe to it, if you’d like to get notified of progress.

1 Like