diff --git a/README.md b/README.md index ca1a97e..ac235b1 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/backlight b/backlight new file mode 100755 index 0000000..1d54f84 --- /dev/null +++ b/backlight @@ -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) } +' diff --git a/config b/config index 808737b..7f517e5 100644 --- a/config +++ b/config @@ -5,6 +5,10 @@ separator=false command=$HOME/.config/i3blocks/$BLOCK_NAME interval=5 +[backlight] +label=backlight +interval=2 + [storage] label=storage