diff options
| author | Suleyman Farajli <suleyman@farajli.net> | 2025-10-26 22:23:31 +0400 |
|---|---|---|
| committer | Suleyman Farajli <suleyman@farajli.net> | 2025-10-26 22:23:31 +0400 |
| commit | cb78290f31886fb1f9a5e7c2a764dda55a459e50 (patch) | |
| tree | 72a2df0645405658d8590d4b8d7d87f1e099f596 /scripts/cli/slight | |
| parent | f8d1bfbd0f27e0763cf75fcda58d010e346515ab (diff) | |
chore: split script installation into CLI and GUI sections
Diffstat (limited to 'scripts/cli/slight')
| -rwxr-xr-x | scripts/cli/slight | 48 |
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 |
