21 lines
484 B
Fish
21 lines
484 B
Fish
|
#!/usr/bin/fish
|
||
|
xbacklight $argv[1..-1]
|
||
|
|
||
|
set file /tmp/notify-brightness.id
|
||
|
set age (find "$file" -cmin -0.2)
|
||
|
|
||
|
set brightness (xbacklight -get)
|
||
|
set bar (seq -s "─" 0 (math $brightness / 3) | tr -d '[:digit:]')
|
||
|
|
||
|
set percentage (printf '%44s%d%%' '' "$brightness")
|
||
|
set body "$percentage\n $bar"
|
||
|
|
||
|
if [ -n "$age" ]
|
||
|
dunstify -r (cat "$file") "Brightness" "$body"
|
||
|
touch "$file"
|
||
|
else
|
||
|
set id (dunstify -p "Brightness" "$body")
|
||
|
echo $id > "$file"
|
||
|
chmod 600 "$file"
|
||
|
end
|