summaryrefslogtreecommitdiff
path: root/scripts/cli/slight
blob: 770553a815e904f18ad69981ec2bbe746c5cff98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

. "lib_common.sh"
. "lib_handle.sh"

help() {
cat << EOF
${progname}: 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
}

brightness_handle check_program
[ ${#} != 1 ] && [ ${#} != 2 ] && invalid_use

while getopts "i:d:s:tph" option; do
	case "${option}" in
	i) run --reload-status brightness_handle up "${OPTARG}"    ;;
	d) run --reload-status brightness_handle down "${OPTARG}"  ;;
	s) run --reload-status brightness_handle set "${OPTARG}"   ;;
	t) run --reload-status brightness_handle toggle            ;;
	p) brightness_handle get-current ;;
	h) help ;;

	*) invalid_use -h ;;
	esac
done
invalid_use