Created
January 11, 2017 04:45
-
-
Save anonymous/237fa54f576ed862233ada3e51a4ff2e to your computer and use it in GitHub Desktop.
/etc/acpi/default.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # /etc/acpi/default.sh | |
| # Default acpi script that takes an entry for all actions | |
| set $* | |
| group=${1%%/*} | |
| action=${1#*/} | |
| device=$2 | |
| id=$3 | |
| value=$4 | |
| log_unhandled() { | |
| logger "ACPI event unhandled: $*" | |
| } | |
| case "$group" in | |
| button) | |
| case "$action" in | |
| power) | |
| /etc/acpi/actions/powerbtn.sh | |
| ;; | |
| # if your laptop doesnt turn on/off the display via hardware | |
| # switch and instead just generates an acpi event, you can force | |
| # X to turn off the display via dpms. note you will have to run | |
| # 'xhost +local:0' so root can access the X DISPLAY. | |
| #lid) | |
| # xset dpms force off | |
| # ;; | |
| lid) | |
| if grep -q closed /proc/acpi/button/lid/LID0/state | |
| then pm-suspend | |
| fi | |
| ;; | |
| suspend) | |
| pm-suspend | |
| ;; | |
| sleep) | |
| pm-suspend | |
| ;; | |
| *) | |
| log_unhandled $* | |
| ;; | |
| esac | |
| ;; | |
| ac_adapter) | |
| case "$value" in | |
| # Add code here to handle when the system is unplugged | |
| # (maybe change cpu scaling to powersave mode). For | |
| # multicore systems, make sure you set powersave mode | |
| # for each core! | |
| #*0) | |
| # cpufreq-set -g powersave | |
| # ;; | |
| # Add code here to handle when the system is plugged in | |
| # (maybe change cpu scaling to performance mode). For | |
| # multicore systems, make sure you set performance mode | |
| # for each core! | |
| #*1) | |
| # cpufreq-set -g performance | |
| # ;; | |
| *) log_unhandled $* ;; | |
| esac | |
| ;; | |
| *) log_unhandled $* ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment