34 lines
957 B
Fish
Executable file
34 lines
957 B
Fish
Executable file
#!/usr/bin/fish
|
|
xbacklight $argv[1..-1]
|
|
|
|
# TODO DDC stuff
|
|
#if pidof ddcutil
|
|
# exit 1
|
|
#end
|
|
|
|
set brightness (cat /sys/class/backlight/intel_backlight/brightness)
|
|
set bar (seq -s "─" 0 (math $brightness / 42) | tr -d '[:digit:]')
|
|
set percentage (printf '%16s%d%%' '' (math $brightness / 12))
|
|
|
|
# TODO DDC stuff figure this out again someday
|
|
#set brightness (ddcutil getvcp 10 -t | awk '{print $4}')
|
|
#set brightness (math $brightness $argv[1..-1])
|
|
#set bar (seq -s "─" 0 (math $brightness / 3.5) | tr -d '[:digit:]')
|
|
#set percentage (printf '%38s%d%%' '' $brightness)
|
|
|
|
set body "$percentage\n $bar"
|
|
set title ' Helderheid'
|
|
|
|
set file /tmp/notify-brightness.id
|
|
set age (find "$file" -cmin -0.025)
|
|
if [ -n "$age" ]
|
|
notify-send.sh -r (cat "$file") -t 1500 "$title" "$body"
|
|
touch "$file"
|
|
else
|
|
set id (notify-send.sh -p -t 1500 "$title" "$body")
|
|
echo $id > "$file"
|
|
chmod 600 "$file"
|
|
end
|
|
|
|
# TODO DDC stuff
|
|
#ddcutil setvcp 10 $brightness
|