eizoctl: add an option to list monitors

This commit is contained in:
Přemysl Eric Janouch 2025-07-31 20:49:59 +02:00
parent b4c1817c10
commit 135f336a7c
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 22 additions and 2 deletions

View File

@ -70,6 +70,17 @@ exe := A_Startup . "\eizoctltray.exe"
} }
``` ```
On macOS, the simplest way to bind keyboard shortcuts is the Shortcuts app,
with _Run Shell Scripts_ actions:
```
/Applications/eizoctltray.app/Contents/MacOS/eizoctltray -q --input HDMI
```
If you have issues with entering a specific key combination, like I did
with ^⌘F1 etc., try changing it later within _System Settings_ → _Keyboard_ →
_Keyboard Shortcuts..._ → _Services_ → _Shortcuts_.
elksmart-comm elksmart-comm
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
_elksmart-comm_ interfaces with ELK Smart infrared dongles EKX4S and EKX5S-T, _elksmart-comm_ interfaces with ELK Smart infrared dongles EKX4S and EKX5S-T,

View File

@ -1037,6 +1037,8 @@ eizo_watch(struct eizo_monitor *m, print_fn output, print_fn error)
} }
static const char *usage = "Usage: %s OPTION...\n\n" static const char *usage = "Usage: %s OPTION...\n\n"
" -l, --list\n"
" List all connected EIZO monitors, with their serial number.\n"
" -b, --brightness [+-]BRIGHTNESS\n" " -b, --brightness [+-]BRIGHTNESS\n"
" Change monitor brightness; values go from 0 to 1 and may be relative.\n" " Change monitor brightness; values go from 0 to 1 and may be relative.\n"
" -i, --input NAME\n" " -i, --input NAME\n"
@ -1057,6 +1059,7 @@ run(int argc, char *argv[], print_fn output, print_fn error)
{ {
const char *name = argv[0]; const char *name = argv[0];
static struct option opts[] = { static struct option opts[] = {
{"list", no_argument, NULL, 'l'},
{"brightness", required_argument, NULL, 'b'}, {"brightness", required_argument, NULL, 'b'},
{"input", required_argument, NULL, 'i'}, {"input", required_argument, NULL, 'i'},
{"restart", no_argument, NULL, 'r'}, {"restart", no_argument, NULL, 'r'},
@ -1069,11 +1072,14 @@ run(int argc, char *argv[], print_fn output, print_fn error)
int quiet = 0; int quiet = 0;
double brightness = NAN; double brightness = NAN;
bool relative = false, restart = false, events = false; bool list = false, relative = false, restart = false, events = false;
const char *port = NULL; const char *port = NULL;
int c = 0; int c = 0;
while ((c = getopt_long(argc, argv, "b:i:reqhV", opts, NULL)) != -1) while ((c = getopt_long(argc, argv, "lb:i:reqhV", opts, NULL)) != -1)
switch (c) { switch (c) {
case 'l':
list = true;
break;
case 'b': case 'b':
relative = *optarg == '+' || *optarg == '-'; relative = *optarg == '+' || *optarg == '-';
if (sscanf(optarg, "%lf", &brightness) && isfinite(brightness)) if (sscanf(optarg, "%lf", &brightness) && isfinite(brightness))
@ -1133,6 +1139,9 @@ run(int argc, char *argv[], print_fn output, print_fn error)
continue; continue;
} }
if (list)
output("%s %s\n", m.product, m.serial);
if (isfinite(brightness)) { if (isfinite(brightness)) {
double prev = 0.; double prev = 0.;
if (!eizo_get_brightness(&m, &prev)) { if (!eizo_get_brightness(&m, &prev)) {