mirror of
https://github.com/emersion/kanshi
synced 2024-09-19 18:35:44 +02:00
Allow shell glob patterns in output description
This commit is contained in:
parent
dc9f4c8fc3
commit
b844e9040b
@ -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
|
||||
|
@ -30,7 +30,7 @@ Directives are followed by space-separated arguments. Arguments can be quoted
|
||||
*output* <criteria> <output-command...>
|
||||
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*.
|
||||
|
4
main.c
4
main.c
@ -1,6 +1,7 @@
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fnmatch.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user