/pulseaudio-acpi-volume

Control PulseAudio volume with ACPI events

Primary LanguageShellBSD 3-Clause Clear LicenseBSD-3-Clause-Clear

pulseaudio-acpi-volume

This package implements a systemd unit and shell scripts for controlling volume levels in response to ACPI events.

This is required because PulseAudio has to be controlled by the user running the service, so adding acpid event handlers (which run as root) does not work. This is better than having a window manager handle the events because it works from a virtual terminal as well.

Configuration

Because this is a user unit, and acpid is a system unit, systemd cannot handle the dependency itself. First, enable and start acpid.service.

sudo systemctl enable acpid.service
sudo systemctl start acpid.service

Then enable and start this service.

systemctl --user enable pulseaudio-acpi-volume.service
systemctl --user start pulseaudio-acpi-volume.service

Implementation

acpid writes its events to a socket, which this service listens to. The handled events are

  • button/volumeup -- increase the volume on the default sink
  • button/volumedown -- decrease the volume on the default sink
  • button/mute -- mute the volume on the default sink
  • button/f20 -- mute the default source (microphone)

button/f20 is the event generated by the microphone mute button on a Thinkpad T480s laptop (and other Thinkpad laptops). There is currently no way to configure the ACPI event corresponding to muting the default source.