Added wander
This commit is contained in:
parent
7d1926f778
commit
312d3521d6
2 changed files with 21 additions and 2 deletions
|
@ -7,8 +7,8 @@ pkill swayidle
|
||||||
|
|
||||||
swayidle -w \
|
swayidle -w \
|
||||||
timeout 300 \
|
timeout 300 \
|
||||||
'brightnessctl -s set 15%' \
|
"~/.scripts/wander.sh" \
|
||||||
resume 'brightnessctl -r' \
|
resume "~/.scripts/wander.sh" \
|
||||||
timeout 600 \
|
timeout 600 \
|
||||||
'swaymsg "output * dpms off"' \
|
'swaymsg "output * dpms off"' \
|
||||||
resume 'swaymsg "output * dpms on"' \
|
resume 'swaymsg "output * dpms on"' \
|
||||||
|
|
19
scripts/wander.sh
Executable file
19
scripts/wander.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Toggle brightness to 'sleep' or 'awake', since brightnessctl does not support
|
||||||
|
# percentages of current amount.
|
||||||
|
# Just run the script (twice)
|
||||||
|
|
||||||
|
# Permanent memory
|
||||||
|
previous=''
|
||||||
|
|
||||||
|
if [ -z "${previous}" ] ; then
|
||||||
|
current=$( cat /sys/class/backlight/intel_backlight/actual_brightness )
|
||||||
|
# Doesn't have to be accurate so we can use built-in calculator.
|
||||||
|
echo $(( current / 10 * 3 )) > /sys/class/backlight/intel_backlight/brightness
|
||||||
|
else
|
||||||
|
echo "${previous}" > /sys/class/backlight/intel_backlight/brightness
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write to file
|
||||||
|
sed -i "s/^previous=.*$/previous=${current:-''}/" "${0}"
|
||||||
|
|
Loading…
Reference in a new issue