diff options
| author | Inqiyad Sabr <sabr@ariamath.xyz> | 2025-11-18 14:40:39 +0600 |
|---|---|---|
| committer | Inqiyad Sabr <sabr@ariamath.xyz> | 2025-11-18 14:40:39 +0600 |
| commit | 9eda8f8a0bab4e60911647f03c48307de38a13dc (patch) | |
| tree | d91cc219b013b28fcfd05ae7d08afbede4ac5b7d | |
| parent | a0f358d43f7ed0601dab4335ff84b5a884d1ecb7 (diff) | |
notification about brightness level on change
| -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" |