aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2022-11-13 09:41:42 +0100
committerThomas Voss <mail@thomasvoss.com> 2022-11-13 09:41:42 +0100
commite102c45988a7460408197f44d09f5c5a3b870e48 (patch)
tree90e1c832d2dabb21cee6d6ed24b81aa3c683ae78
parent8f60ff9a434f90cadb4d4a1e8564a4e0bf8741f0 (diff)
Add the -m flag to query maximum brightness
-rw-r--r--lux.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lux.c b/lux.c
index 0959bb7..0ab0d15 100644
--- a/lux.c
+++ b/lux.c
@@ -36,7 +36,7 @@ main(int argc, char **argv)
int br, max, opt;
double pr;
lux_t disp;
- const char *optstr = "d:D:gGi:I:s:S:";
+ const char *optstr = "d:D:gGi:I:ms:S:";
static struct option longopts[] = {
{"decrease", required_argument, NULL, 'd'},
{"decrease-percent", required_argument, NULL, 'D'},
@@ -44,6 +44,7 @@ main(int argc, char **argv)
{"get-percent", no_argument, NULL, 'G'},
{"increase", required_argument, NULL, 'i'},
{"increase-percent", required_argument, NULL, 'I'},
+ {"max", no_argument, NULL, 'm'},
{"set", required_argument, NULL, 's'},
{"set-percent", required_argument, NULL, 'S'},
{NULL, 0, NULL, 0}
@@ -58,6 +59,11 @@ main(int argc, char **argv)
break;
switch (opt) {
+ case 'm':
+ if ((max = luxmax(&disp)) == -1)
+ die("luxmax");
+ printf("%d\n", max);
+ break;
case 'g':
if ((br = luxget(&disp)) == -1)
die("luxget");
@@ -139,6 +145,6 @@ parsedouble(char *s)
void
usage(char *s)
{
- fprintf(stderr, "Usage: %s [-gG | -dDiIsS val]\n", s);
+ fprintf(stderr, "Usage: %s [-gGm | -dDiIsS val]\n", s);
exit(EXIT_FAILURE);
}