pub / dotfiles

Configuration of software on my computer
git clone https://src.jayvii.de/pub/dotfiles.git
Home | Log | Files | Exports | Refs | RSS

commit 0dc6ab044d284de48d08d32a00bdfba09615bee4
parent eff55d413cc15f5f85577f61eea515a4381f5e57
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Wed, 19 Jun 2024 21:42:08 +0200

simplify brightness adjust script

Diffstat:
Mwayfire/.local/bin/brightness.sh | 22++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/wayfire/.local/bin/brightness.sh b/wayfire/.local/bin/brightness.sh @@ -7,8 +7,8 @@ PER=$((($CUR * 100) / $MAX)) # If no argument is given, return current value if [[ -z $1 ]]; then - echo "return value" echo "$PER" + exit 0 fi # increasing brightness @@ -20,15 +20,9 @@ if [[ "$1" == "inc" ]]; then PER_NEW=100 fi - # calculate numerical value - CUR_NEW=$(((${MAX} * ${PER_NEW}) / 100)) - - # set new value - echo "Setting brightness to $CUR_NEW" - echo "$CUR_NEW" > "${DEV}/brightness" - fi +# decrease brightness if [[ "$1" == "dec" ]]; then # calculate new value in percent, capt at 5% @@ -37,11 +31,11 @@ if [[ "$1" == "dec" ]]; then PER_NEW=5 fi - # calculate numerical value - CUR_NEW=$(((${MAX} * ${PER_NEW}) / 100)) +fi - # set new value - echo "Setting brightness to $CUR_NEW" - echo "$CUR_NEW" > "${DEV}/brightness" +# calculate numerical value +CUR_NEW=$(((${MAX} * ${PER_NEW}) / 100)) -fi +# set new value +echo "Setting brightness to $CUR_NEW" +echo "$CUR_NEW" > "${DEV}/brightness"