diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | sbc | 17 |
2 files changed, 10 insertions, 9 deletions
@@ -2,7 +2,7 @@ A simple tool to increase decrease and set brightness, infact that's all it does ;-) # License -The Unlicense <https://unlicense.org> +See LICENSE for more information. # Installation To install this you just need to put this script in one of your preferred `${PATH}`s and you are done! @@ -7,24 +7,25 @@ # Honestly, brightnessctl is bloat. # ================================== device="$(find /sys/class/backlight/*)" -fmax="$device/max_brightness" -fnow="$device/brightness" -m="$(cat "$fmax")" -c="$(cat "$fnow")" +fmax="${device}/max_brightness" +fcur="${device}/brightness" +m="$(cat "${fmax}")" +c="$(cat "${fcur}")" if [ $# -gt 1 ]; then case "$1" in - "-s") printf "%d" $(($2 * m / 100)) > "$fnow";; - "-i") printf "%d" $((c + $2 * m / 100)) > "$fnow";; - "-d") printf "%d" $((c - $2 * m / 100)) > "$fnow";; + "-s") printf "%d" "$(($2 * m / 100))" > "${fcur}" ;; + "-i") printf "%d" "$((c + $2 * m / 100))" > "${fcur}" ;; + "-d") printf "%d" "$((c - $2 * m / 100))" > "${fcur}" ;; esac + notify-send "Brigthness Info" "Current Brightness: $((c * 100 / m))%" else case "$1" in "-v") printf "brl v0.0.1\n" printf "A simple brightness control program\n" ;; - "-h") + "-h"|"--help") printf "brl [options] [value]\n" printf " -s set brightness %%\n" printf " -i increase brightness %%\n" |