Work in progress.
To use the volume keys on your keyboard on linux or with a raspberry pi in particular, you can use the triggerhappy package, which comes pre-installed with raspbian.
The trigger happy config has to be saved at `/etc/triggerhappy/triggers.d/*.conf. We first specify the key, followed by the corresponding action to take.
KEY_VOLUMEUP 1 /usr/bin/amixer -M set PCM 5%+ KEY_VOLUMEUP 2 /usr/bin/amixer -M set PCM 5%+ KEY_VOLUMEDOWN 1 /usr/bin/amixer -M set PCM 5%- KEY_VOLUMEDOWN 2 /usr/bin/amixer -M set PCM 5%- KEY_MIN_INTERESTING 1 /usr/bin/amixer set PCM 1+ toggle
amixer, otherwise the volume will jump like crazy(e.g. from mute to 91% with one key-press). From the man page: "-M Use the mapped volume for evaluating the percentage representation like alsamixer, to be more natural for human ear."
Restart the trigger happy demon after you have edited the configuration:
systemctl restart triggerhappy
You can also find the correct names of specific keys with
thd --dump /dev/input/event*
or watch commands and their output being executed with
thd --triggers /etc/triggerhappy/triggers.d/ /dev/input/event*