aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/brightness
blob: c1c613904ad65fc6df350d425918ab6ff61bde5e (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
#!/bin/sh
case "$*" in
	+*) action="+" ;;
	-*) action="-" ;;
	*) action="=" ;;
esac
value="$(echo "$*" | tr -dc '[[:digit:]]')"

if [ -n "$(command -v xbacklight)" ] ; then
	[ "$action" = "+" ] && action="-inc"
	[ "$action" = "-" ] && action="-dec"
	[ "$action" = "=" ] && action="-set"

	fork xbacklight -time 100 -fps 60 $action $value

	exit 0

elif [ -n "$(command -v ddcutil)" ] ; then
	[ "$action" = "=" ] && action=""

	for bus in 2 3 ; do
		fork ddcutil --bus="$bus" --skip-ddc-checks --noverify setvcp 10 $action $value
	done

	exit 0

fi
exit 1