2018-11-26 09:38:46 +00:00
|
|
|
#!/usr/bin/fish
|
|
|
|
xbacklight $argv[1..-1]
|
|
|
|
|
|
|
|
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"
|
2018-11-26 11:13:44 +00:00
|
|
|
set title ' Brightness'
|
2018-11-26 09:38:46 +00:00
|
|
|
|
2018-11-26 11:13:44 +00:00
|
|
|
set file /tmp/notify-brightness.id
|
|
|
|
set age (find "$file" -cmin -0.025)
|
2018-11-26 09:38:46 +00:00
|
|
|
if [ -n "$age" ]
|
2018-11-26 11:13:44 +00:00
|
|
|
dunstify -r (cat "$file") -t 1500 "$title" "$body"
|
2018-11-26 09:38:46 +00:00
|
|
|
touch "$file"
|
|
|
|
else
|
2018-11-26 11:13:44 +00:00
|
|
|
set id (dunstify -p -t 1500 "$title" "$body")
|
2018-11-26 09:38:46 +00:00
|
|
|
echo $id > "$file"
|
|
|
|
chmod 600 "$file"
|
|
|
|
end
|