1
0
Fork 0

new brightness script

This commit is contained in:
Luca Bilke 2023-03-28 18:46:39 +02:00
parent d910da0651
commit 668c70402a
No known key found for this signature in database
GPG Key ID: 7B77C51E8C779E75
3 changed files with 33 additions and 3 deletions

32
.local/bin/brightness-notify Executable file
View File

@ -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

2
TODO
View File

@ -1,5 +1,3 @@
TODO: Add librewolf userprefs file, separate cascade config file
TODO: https://sw.kovidgoyal.net/kitty/kittens/panel/
TODO: Create a better bitwarden integration
TODO: Create a brightness indicator for dunst
TODO: Look into nix and their home manager