Allow all glob patterns in output configs

Instead of special casing "output * ..." just make output take all glob
patterns.
This commit is contained in:
Pedro Côrte-Real 2020-08-18 23:43:24 +01:00
parent db8134a7c4
commit f85ea8c39f
2 changed files with 8 additions and 4 deletions

View file

@ -516,7 +516,7 @@ struct output_config *find_output_config(struct sway_output *sway_output) {
char *name = sway_output->wlr_output->name;
for (int i = 0; i < config->output_configs->length; ++i) {
struct output_config *oc = config->output_configs->items[i];
if (!strcmp(oc->name, "*") || !strcmp(oc->name, name) || !strcmp(oc->name, id)) {
if (!fnmatch(oc->name, name, 0) || !fnmatch(oc->name, id, 0)) {
merge_output_config(result, oc);
}
}

View file

@ -11,9 +11,9 @@ You may combine output commands into one, like so:
output HDMI-A-1 mode 1920x1080 pos 1920 0 bg ~/wallpaper.png stretch
You can get a list of output names with *swaymsg -t get_outputs*. You may also
match any output by using the output name "\*". Additionally, "-" can be used
to match the focused output by name and "--" can be used to match the focused
output by its identifier.
match using glob patterns including any output by using the output name "\*".
Additionally, "-" can be used to match the focused output by name and "--" can
be used to match the focused output by its identifier.
Some outputs may have different names when disconnecting and reconnecting. To
identify these, the name can be substituted for a string consisting of the make,
@ -22,6 +22,10 @@ must be separated by one space. For example:
output "Some Company ABC123 0x00000000" pos 1920 0
Glob patterns can be used to match any output of that make and model:
output "Some Company ABC123\*" pos 1920 0
# COMMANDS
*output* <name> mode|resolution|res [--custom] <WIDTHxHEIGHT>[@<RATE>Hz]