summaryrefslogtreecommitdiff
path: root/scripts/cli/slight
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-10-26 22:23:31 +0400
commitcb78290f31886fb1f9a5e7c2a764dda55a459e50 (patch)
tree72a2df0645405658d8590d4b8d7d87f1e099f596 /scripts/cli/slight
parentf8d1bfbd0f27e0763cf75fcda58d010e346515ab (diff)
chore: split script installation into CLI and GUI sections
Diffstat (limited to 'scripts/cli/slight')
-rwxr-xr-xscripts/cli/slight48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/cli/slight b/scripts/cli/slight
new file mode 100755
index 0000000..0289ff4
--- /dev/null
+++ b/scripts/cli/slight
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. slib
+
+help() {
+cat << EOF
+${0}: Wrapper script to change backlight
+options:
+ -i [Brg] Increase backlight by Brg
+ -d [Brg] Decrease backlight by Brg
+ -s [Brg] Set backlight to Brg
+ -p Show the current backlight
+ -h Print this message and exit
+
+NOTE: Script interprets values as percentages
+EOF
+
+exit 0
+}
+
+check_program "brightnessctl"
+
+[ ${#} != 1 ] && [ ${#} != 2 ] && invalid_use
+
+while getopts "i:d:s:ph" option; do
+ case "${option}" in
+ i) run --reload-status "brightnessctl set +${OPTARG}%" ;;
+
+ d) run --reload-status "brightnessctl set ${OPTARG}-%" ;;
+
+ s) run --reload-status "brightnessctl set ${OPTARG}%" ;;
+
+ p)
+ if ! echo $(( ($(brightnessctl g) * 100) / $(brightnessctl m) )); then
+ err "Failed to get current brightness"
+ else
+ exit 0
+ fi
+ ;;
+ h) help ;;
+
+ *) invalid_use -h ;;
+
+ esac
+done
+
+# Unreachable
+invalid_use