Hello @emersion, any thoughts on this ?
Just notice this is the solution you suggests on the issue
https://todo.sr.ht/~emersion/kanshi/49
It would works in most usecases and it would be even more usefull since
wildcards
outputs are not allowed anymore.
---
This fixes the missing '\' in the man page.
doc/kanshi.5.scd | 7 ++++---main.c | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/doc/kanshi.5.scd b/doc/kanshi.5.scd
index 74ada4d..8b97d6d 100644
--- a/doc/kanshi.5.scd+++ b/doc/kanshi.5.scd
@@ -71,9 +71,10 @@ quoted (with *"*) if they contain spaces.
may change across reboots (depending on kernel driver probe order) or
creation order (typically for USB-C docks).
- A space-separated string containing the output manufacturer, model and
- serial number (e.g. "Foocorp ASDF 1234"). If one of these fields is- missing, it needs to be populated with the string "Unknown" (e.g.- "Foocorp ASDF Unknown").+ serial number (e.g. "Foocorp ASDF 1234"). It is possible to use a shell+ wildcard pattern (e.g. "Foocorp ASDF 1\*") see *glob*(7).+ If one of these fields is missing, it needs to be populated with the+ string "Unknown" (e.g. "Foocorp ASDF Unknown"). - An output alias (e.g. "$work-desk3") defined by an output alias directive.
Output aliases can only be used in profile scope.
- A wildcard "\*", to match any output.
diff --git a/main.c b/main.c
index f575d83..d91b031 100644
--- a/main.c+++ b/main.c
@@ -1,6 +1,7 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
+#include <fnmatch.h>#include <getopt.h>
#include <limits.h>
#include <signal.h>
@@ -35,7 +36,7 @@ static bool match_profile_output(struct kanshi_profile_output *output,
return strcmp(output->name, "*") == 0 ||
strcmp(output->name, head->name) == 0 ||
- strcmp(output->name, identifier) == 0;+ fnmatch(output->name, identifier, 0) == 0;}
static bool match_profile(struct kanshi_state *state,
--
2.45.2
kanshi/patches/.build.yml: SUCCESS in 30s
[Add support for wildcard in output identifier][0] v2 from [Tarek Marcé][1]
[0]: https://lists.sr.ht/~emersion/public-inbox/patches/53560
[1]: mailto:tarek.marce@free.fr
✓ #1263001 SUCCESS kanshi/patches/.build.yml https://builds.sr.ht/~emersion/job/1263001