From fdff328382982eded07bebac37eb5d71bde5a1d4 Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Wed, 24 Nov 2021 14:53:56 +0800 Subject: [PATCH] Brightness now prints current brighness if no arguments given. --- .config/wm_scripts/brightness.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.config/wm_scripts/brightness.sh b/.config/wm_scripts/brightness.sh index 55263b7..3867129 100755 --- a/.config/wm_scripts/brightness.sh +++ b/.config/wm_scripts/brightness.sh @@ -3,8 +3,12 @@ [ -z $IS_LAPTOP ] && exit blpath=/sys/class/backlight/intel_backlight + +max=$(cat $blpath/max_brightness) +current=$(cat $blpath/brightness) if [ -z $1 ] then + printf %.0f\\n $(echo "$current/$max * 100" | bc -l) exit elif (( $1 < 10 )) then @@ -16,7 +20,6 @@ else perc=$1 fi -max=$(cat $blpath/max_brightness) brightness="$(($max * $perc / 100))" echo $brightness > $blpath/brightness