Fix Brightness script

This commit is contained in:
Out Of Ideas 2024-04-10 11:21:27 -05:00
parent 83beb58a15
commit 96fe2e5c2a
1 changed files with 8 additions and 0 deletions

View File

@ -10,9 +10,17 @@ BRIGHTNESS=$(brightnessctl | head -2 | tail +2 | awk '{print $4}' | tr -cd '[[:d
# Then Set the Brightnes to the
# Brightness at the time the Brightness was Turned Off
if $(cat $STATUS_FILE2); then
# If the Brightness is not zero
# (it was changed with the slider rather than the button),
# Turn the brightness off again.
if [ $BRIGHTNESS -gt 0 ]; then
eww update brightness=0
# Make the slider empty
eww update metric-brightness="zero"
# Send the Brightness when pressing the button to the status file,
# so that the program sets that value next time.
echo $BRIGHTNESS > $STATUS_FILE
# Set the Brightness to 0
doas /usr/bin/brightnessctl s 0%
fi
doas /usr/bin/brightnessctl s $(cat $STATUS_FILE)%