new brightness script
This commit is contained in:
parent
d910da0651
commit
668c70402a
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
calc() {
|
||||
awk "BEGIN {print int($*)}"
|
||||
}
|
||||
|
||||
msgTag="brightness" # Arbitrary but unique message tag
|
||||
oldbrightness="$(cat /sys/class/backlight/*/brightness)"
|
||||
newbrightness="$(calc "$oldbrightness + $1 * 2.55")"
|
||||
percentage=$(calc "$newbrightness * .39215686274509803921")
|
||||
highlight="#7aa2f7"
|
||||
|
||||
if [ "$percentage" -gt "100" ]; then
|
||||
icon="gpm-brightness-lcd"
|
||||
percentage=100
|
||||
newbrightness=255
|
||||
elif [ "$percentage" -gt "50" ]; then
|
||||
icon="gpm-brightness-lcd"
|
||||
elif [ "$percentage" -gt "0" ]; then
|
||||
icon="gpm-brightness-lcd-disabled"
|
||||
else
|
||||
icon="gpm-brightness-lcd-disabled"
|
||||
percentage=0
|
||||
newbrightness=0
|
||||
fi
|
||||
|
||||
echo $newbrightness | tee /sys/class/backlight/*/brightness
|
||||
|
||||
notify-send -a "changeBrightness" -i "$icon" -u low "Brightness: ${percentage}%" \
|
||||
-h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:$percentage \
|
||||
-h string:hlcolor:$highlight
|
|
@ -1 +1 @@
|
|||
Subproject commit 166f942f788b9b50676ca5e5869f4b9621e45d8f
|
||||
Subproject commit db89de50d9acc335bc0c65e7be1cf2268ce9e2dd
|
Loading…
Reference in New Issue