Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Default acpi script that takes an entry for all actions
- fxply () {
- sudo -u fierce_brake env -i bash -c "XDG_RUNTIME_DIR='/run/user/1000' DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus' $1"
- return 0
- }
- case "$1" in
- button/power)
- case "$2" in
- PBTN|PWRF)
- logger 'PowerButton pressed'
- ;;
- *)
- logger "ACPI action undefined: $2"
- ;;
- esac
- ;;
- button/sleep)
- case "$2" in
- SLPB|SBTN)
- logger 'SleepButton pressed'
- ;;
- *)
- logger "ACPI action undefined: $2"
- ;;
- esac
- ;;
- ac_adapter)
- case "$2" in
- AC|ACAD|ADP0)
- case "$4" in
- 00000000)
- logger 'AC unpluged'
- ;;
- 00000001)
- logger 'AC pluged'
- ;;
- esac
- ;;
- *)
- logger "ACPI action undefined: $2"
- ;;
- esac
- ;;
- battery)
- case "$2" in
- BAT0)
- case "$4" in
- 00000000)
- logger 'Battery online'
- ;;
- 00000001)
- logger 'Battery offline'
- ;;
- esac
- ;;
- CPU0)
- ;;
- *) logger "ACPI action undefined: $2" ;;
- esac
- ;;
- button/lid)
- case "$3" in
- close)
- logger 'LID closed'
- ;;
- open)
- logger 'LID opened'
- ;;
- *)
- logger "ACPI action undefined: $3"
- ;;
- esac
- ;;
- button/volumedown)
- case "$2" in
- VOLDN)
- fxply 'pactl set-sink-volume @DEFAULT_SINK@ -5%'
- fxply 'notify-send "VolD" --icon=audio-volume-low'
- ;;
- esac
- ;;
- button/volumeup)
- case "$2" in
- VOLUP)
- fxply 'pactl set-sink-volume @DEFAULT_SINK@ +5%'
- fxply 'notify-send "VolU" --icon=audio-volume-high'
- ;;
- esac
- ;;
- button/mute)
- case "$2" in
- MUTE)
- fxply 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
- fxply 'notify-send "Mute" --icon=audio-volume-muted'
- ;;
- esac
- ;;
- cd/prev)
- case "$2" in
- CDPREV)
- fxply 'playerctl previous'
- fxply 'notify-send "Prev" --icon=media-skip-backward'
- ;;
- esac
- ;;
- cd/play)
- case "$2" in
- CDPLAY)
- fxply 'playerctl play-pause'
- fxply 'notify-send "Play" --icon=media-playback-start'
- ;;
- esac
- ;;
- cd/next)
- case "$2" in
- CDNEXT)
- fxply 'playerctl next'
- fxply 'notify-send "Next" --icon=media-skip-forward'
- ;;
- esac
- ;;
- *)
- logger "ACPI group/action undefined: $1 / $2"
- ;;
- esac
- # vim:set ts=4 sw=4 ft=sh et:
Advertisement
Add Comment
Please, Sign In to add comment