From cb78290f31886fb1f9a5e7c2a764dda55a459e50 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Sun, 26 Oct 2025 22:23:31 +0400 Subject: chore: split script installation into CLI and GUI sections --- scripts/cli/slight | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 scripts/cli/slight (limited to 'scripts/cli/slight') 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 -- cgit v1.2.3