add backlight support

This commit is contained in:
koksnuss 2018-05-14 00:11:55 +02:00
parent 25376777d1
commit d1571c5592
3 changed files with 17 additions and 1 deletions

View File

@ -31,10 +31,10 @@ storage df
- [x] audio
- [x] fix audio not changing on mute
- [x] cpu
- [x] brightness
- [ ] swap
- [ ] wifi/ethernet/bluetooth
- [ ] external storage with mount
- [ ] ethernet bandwith
- [ ] brightness
- [ ] microphone
- [ ] nice icons as labels

12
backlight Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
DIR="/sys/class/backlight/"
if [[ -d "${DIR}acpi_video0" ]]; then
DIR="${DIR}acpi_video0"
elif [[ -d "${DIR}intel_backlight" ]]; then
DIR="${DIR}intel_backlight"
fi
cat "${DIR}/brightness" "${DIR}/max_brightness" | gawk '
NR==1 { cbr=$1 }
NR==2 { mbr=$1 }
END { printf("%d%", cbr/mbr*100) }
'

4
config
View File

@ -5,6 +5,10 @@ separator=false
command=$HOME/.config/i3blocks/$BLOCK_NAME
interval=5
[backlight]
label=backlight
interval=2
[storage]
label=storage