Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Created March 29, 2019 17:58
Show Gist options
  • Save pbrisbin/33c69ffa7eef32b8fea6d49a816130f8 to your computer and use it in GitHub Desktop.
Save pbrisbin/33c69ffa7eef32b8fea6d49a816130f8 to your computer and use it in GitHub Desktop.
#!/bin/sh
amixer_() {
# Workaround
amixer -c 0 sset Headphone unmute
amixer -c 0 sset Speaker unmute
amixer "$@"
}
notify() {
/home/patrick/.local/bin/runx notify-send "$@"
}
logger -t acpid "$*"
case "$1" in
battery) notify "Battery Event" "$(acpi)" ;;
button/f20) amixer -c 0 sset Capture toggle ;; # mic mute
button/mute) amixer_ -c 0 sset Master toggle ;;
button/volumedown) amixer_ -c 0 sset Master '3%-' ;;
button/volumeup) amixer_ -c 0 sset Master '3%+' ;;
video/brightnessup)
read -r val < /sys/class/backlight/intel_backlight/brightness
echo $((val+77)) > /sys/class/backlight/intel_backlight/brightness
;;
video/brightnessdown)
read -r val < /sys/class/backlight/intel_backlight/brightness
echo $((val-77)) > /sys/class/backlight/intel_backlight/brightness
;;
#*) notify "ACPI Event" "$(printf "%s\n" "$@")" ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment