aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xsbc17
2 files changed, 10 insertions, 9 deletions
diff --git a/README.md b/README.md
index 8638503..489e241 100644
--- a/README.md
+++ b/README.md
@@ -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!
diff --git a/sbc b/sbc
index 4f17d03..d2c09f1 100755
--- a/sbc
+++ b/sbc
@@ -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"