feat: sbar wlp module, dwm builtin set-light
This commit is contained in:
parent
36576bb3cb
commit
0b54bbc089
10 changed files with 61 additions and 49 deletions
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
shopt -s extglob nullglob
|
||||
|
||||
set_brightness() {
|
||||
local max; max="$(cat "$1"/max_brightness)"
|
||||
local file="$1"/brightness
|
||||
local val="$(($2 * max / 100 + 1))"
|
||||
|
||||
[ "$val" -lt 0 ] && val=0
|
||||
[ "$val" -gt "$max" ] && val="$max"
|
||||
echo "$val" > "$file"
|
||||
}
|
||||
|
||||
CUR_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/current_brightness"
|
||||
CUR="$(cat "$CUR_FILE" 2> /dev/null || echo 50)"
|
||||
|
||||
case "${1:0:1}" in
|
||||
'') echo "$CUR"; exit ;;
|
||||
'+'|'-') NEW="$((CUR - CUR % $1 + $1))" ;;
|
||||
*) NEW="$1" ;;
|
||||
esac
|
||||
|
||||
for dev in /sys/class/backlight/*; do
|
||||
set_brightness "$dev" "$NEW"
|
||||
done
|
||||
|
||||
echo "$NEW" > "$CUR_FILE"
|
||||
|
||||
kill -35 "$(cat "$HOME/.cache/pidofbar")"
|
||||
Loading…
Add table
Add a link
Reference in a new issue