~emersion/public-inbox

kanshi: Add support for wildcard in output identifier v1 PROPOSED

Tarek Marcé: 1
 Add support for wildcard in output identifier

 2 files changed, 6 insertions(+), 4 deletions(-)
#1262997 .build.yml failed
+1 for globbing the output name! My original config looked a lot like
your proposal after I saw "wildcard" in the man docs.

My use case is that I would like to version control my kanshi
config, but I am hesistant to do so because I would need to include the
serial code in the output and the hardware belongs to my company.

Otherwise, really awesome project ~emersion and thank you for writing
this patch, Tarek.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/53559/mbox | git am -3
Learn more about email & git

[PATCH kanshi] Add support for wildcard in output identifier Export this patch

This patch adds support for wildcard in output identifier. This is
useful in some case where the serial number or the model is not known or
can change. Since it is not possible anymore to have multiple wildcard
output this commit is useful for openspace where the monitors are all
the same model but not the same serial number.

It uses the fnmatch function of the libc to allow shell wildcard pattern
in output name string.

Here is an example of a working configuration:

    profile atWork {
      output eDP-1 mode 1920x1200 position 960,1080
      output "HP Inc. HP E24m G4 CN*" {
            mode 1920x1080
            position 0,0
      }
      output "HP Inc. HP E24u G4 CN*" {
            mode 1920x1080
            position 1920,0
      }
    }

Tarek "Kerat" Marcé

---
 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..29e8a68 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: FAILED in 27s

[Add support for wildcard in output identifier][0] from [Tarek Marcé][1]

[0]: https://lists.sr.ht/~emersion/public-inbox/patches/53559
[1]: mailto:tarek.marce@free.fr

✗ #1262997 FAILED kanshi/patches/.build.yml https://builds.sr.ht/~emersion/job/1262997