summaryrefslogtreecommitdiff
path: root/overlays/avizo/min-value.patch
blob: 629fe3ed5d55fbbdc4fe4c8debf4942d0af6ce13 (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
37
38
diff --git a/lightctl b/lightctl
index f5333ae..6a68aef 100755
--- a/lightctl
+++ b/lightctl
@@ -16,6 +16,7 @@
 #
 # Options:
 #   -e <exponent>   Change percentage curve to exponential (only for brightnessctl).
+#   -n <min_value>  Set minimum value (only for brightnessctl).
 #   -D <device>     Specify the device name.
 #   -M <monitornr>  Set monitor where notification will be shown.
 #   -d              Show dark theme friendly variant of the icon
@@ -47,13 +48,15 @@ is_float() {
 }
 
 exp=
+min=
 dev=
 optind=1
 dark=0
 monitor=-1
-while getopts ':e:D:h:M:d' OPT; do
+while getopts ':e:n:D:h:M:d' OPT; do
 	case "$OPT" in
 		e) exp=$OPTARG;;
+		n) min=$OPTARG;;
 		D) dev=$OPTARG;;
 		h) help; exit 0;;
 		M) monitor="$OPTARG";;
@@ -96,7 +99,7 @@ esac
 if command -v brightnessctl >/dev/null; then
 	prog='brightnessctl'
 	opts="${dev:+-d $dev}"
-	out=$(brightnessctl $opts ${exp:+-e$exp} -m set "${value}%${cmd}")
+	out=$(brightnessctl $opts ${exp:+-e$exp} ${min:+-n$min} -m set "${value}%${cmd}")
 	light=$(printf '%s\n' "$out" | cut -d, -f4)
 	light=${light%\%}