Save power mode before sleep, set to power-saver, then restore
This commit is contained in:
parent
b32759643a
commit
20102a4006
|
@ -7,6 +7,7 @@ SLEEP_TIMEOUT=600 # ten minutes
|
|||
HIBERNATE_TIMEOUT=3600 # one hour
|
||||
|
||||
BLFILE="$HOME/.local/state/idle.dim"
|
||||
POWERMODE="$HOME/.local/state/power_profile"
|
||||
OPFILE="$HOME/.local/state/active_outputs"
|
||||
STATEFILE="$HOME/.local/state/idle.state"
|
||||
IDLEMODE=$(cat $HOME/.local/state/idle_mode)
|
||||
|
@ -163,6 +164,8 @@ elif [[ $1 == "unlock" ]]; then
|
|||
fi
|
||||
elif [[ $1 == "sleep" ]]; then
|
||||
if [[ $IDLEMODE -gt 3 ]]; then
|
||||
powerprofilesctl get > $POWERMODE
|
||||
powerprofilesctl set power-saver
|
||||
echo 'sleep' > $STATEFILE
|
||||
for i in $(cat $OPFILE); do swaymsg "output $i dpms off"; done
|
||||
fi
|
||||
|
@ -175,6 +178,7 @@ elif [[ $1 == "unsleep" ]]; then
|
|||
if [[ -e $STATEFILE ]]; then
|
||||
rm $STATEFILE
|
||||
fi
|
||||
powerprofilesctl set $(cat $POWERMODE)
|
||||
elif [[ $1 == "hibernate" ]]; then
|
||||
if [[ $IDLEMODE -gt 4 ]]; then
|
||||
echo 'hibernate' > $STATEFILE
|
||||
|
|
Loading…
Reference in New Issue