about summary refs log tree commit diff stats
path: root/pkgs/by-name/br/brightness/brightness.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/br/brightness/brightness.sh26
1 files changed, 9 insertions, 17 deletions
diff --git a/pkgs/by-name/br/brightness/brightness.sh b/pkgs/by-name/br/brightness/brightness.sh
index 887dbb1e..3d6b2335 100755
--- a/pkgs/by-name/br/brightness/brightness.sh
+++ b/pkgs/by-name/br/brightness/brightness.sh
@@ -1,24 +1,23 @@
-#!/usr/bin/env dash
+#!/usr/bin/env sh
 
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+die() {
+    echo "ERROR: $1"
+    exit 1
+}
 
 help() {
     cat <<EOF
 This is a system brightness manager
 
 USAGE:
-    $NAME up [VALUE] | down [VALUE]
+    $NAME set VALUE
 
 OPTIONS:
     --help   | -h
                                 Output this help and exit.
 
-    --version   | -v
-                                Output the version and exit.
-
 COMMANDS:
-    set [VALUE]
+    set VALUE
                                 Set the brightness to the specified percentage.
 
 ARGUMENTS:
@@ -27,17 +26,14 @@ ARGUMENTS:
 EOF
 }
 
-BACKLIGHT="/sys/class/backlight/%BACKLIGHT_NAME"
+BACKLIGHT="/sys/class/backlight/$BACKLIGHT_NAME"
 
 brightness() {
     perc="$1"
 
-    max="$(cat $BACKLIGHT/max_brightness)"
-
+    max="$(cat "$BACKLIGHT/max_brightness")"
     new="$(echo | awk --assign=perc="$perc" '{printf (perc / 100)}')"
-
     output="$(echo | awk --assign=new="$new" --assign=max="$max" '{printf max * new}')"
-
     echo "$output" >"$BACKLIGHT/brightness"
 }
 
@@ -47,10 +43,6 @@ for arg in "$@"; do
         help
         exit 0
         ;;
-    "--version" | "-v")
-        version
-        exit 0
-        ;;
     esac
 done