This repository has been archived on 2019-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
2018-05-14 10:11:19 +02:00

20 lines
430 B
Bash
Executable File

#!/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"
else
echo "not found "
exit 33
fi
cat "${DIR}/brightness" "${DIR}/max_brightness" | gawk '
NR==1 { cbr=$1 }
NR==2 { mbr=$1 }
END {
printf("%d%\n", cbr/mbr*100)
printf("%d\n", cbr/mbr*100)
print("\n")
}
'