Pages

18/03/2019

[Linux] Bind special key press to ALSA control action

If using ALSA, it's possible to bind special keyboard keys to action controls with a few configuration lines.

First of all, to find the available action controls, run in a terminal: amixer scontrols

Then, find the key event we need to bind to the desired action, and add it as an event,action pair in a new configuration file under /etc/acpi/events for example:

event=button/mute MUTE 00000080 00000000 K
action=/usr/bin/amixer sset 'Master',0 toggle

which in this case for my lapotop binds the mute button to the mute action. It is also possible to execute a script instead, for example:

event=ibm/hotkey HKEY 00000080 00001009
action=/etc/acpi/undock.sh

which runs some actions when the laptop is undocked.

No comments:

Post a Comment

With great power comes great responsibility