diff --git a/README.md b/README.md index b9c8f44..2e06219 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,15 @@ enabled if all of the listed outputs are connected. } ``` +Output profiles can contain shell glob patterns: +``` +{ + + output LVDS-1 disable + output "Some Company *" mode 1600x900 position 0,0 +} +``` + ## License MIT diff --git a/kanshi.5.scd b/kanshi.5.scd index d498649..907c6df 100644 --- a/kanshi.5.scd +++ b/kanshi.5.scd @@ -30,7 +30,7 @@ Directives are followed by space-separated arguments. Arguments can be quoted *output* An output directive adds an output to the profile. The criteria can either be an output name, an output description or "\*". The latter can be used to - match any output. + match any output. The output description can contain shell glob patterns. On *sway*(1), output names and descriptions can be obtained via *swaymsg -t get_outputs*. diff --git a/main.c b/main.c index 79ae794..acabca2 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,7 @@ #define _POSIX_C_SOURCE 200809L #include #include +#include #include #include #include @@ -21,8 +22,7 @@ static bool match_profile_output(struct kanshi_profile_output *output, // TODO: improve vendor/model/serial matching return strcmp(output->name, "*") == 0 || strcmp(output->name, head->name) == 0 || - (strchr(output->name, ' ') != NULL && - strstr(head->description, output->name) != NULL); + fnmatch(output->name, head->description, 0) == 0; } static bool match_profile(struct kanshi_state *state,