Skip to content

Commit 6169122

Browse files
committed
Allow all glob patterns in output configs
Instead of special casing "output * ..." just make output take all glob patterns.
1 parent e97bf79 commit 6169122

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

sway/config/output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ struct output_config *find_output_config(struct sway_output *sway_output) {
516516
char *name = sway_output->wlr_output->name;
517517
for (int i = 0; i < config->output_configs->length; ++i) {
518518
struct output_config *oc = config->output_configs->items[i];
519-
if (!strcmp(oc->name, "*") || !strcmp(oc->name, name) || !strcmp(oc->name, id)) {
519+
if (!fnmatch(oc->name, name, 0) || !fnmatch(oc->name, id, 0)) {
520520
merge_output_config(result, oc);
521521
}
522522
}

sway/sway-output.5.scd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ You may combine output commands into one, like so:
1111
output HDMI-A-1 mode 1920x1080 pos 1920 0 bg ~/wallpaper.png stretch
1212

1313
You can get a list of output names with *swaymsg -t get_outputs*. You may also
14-
match any output by using the output name "\*". Additionally, "-" can be used
15-
to match the focused output by name and "--" can be used to match the focused
16-
output by its identifier.
14+
match using glob patterns including any output by using the output name "\*".
15+
Additionally, "-" can be used to match the focused output by name and "--" can
16+
be used to match the focused output by its identifier.
1717

1818
Some outputs may have different names when disconnecting and reconnecting. To
1919
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:
2222

2323
output "Some Company ABC123 0x00000000" pos 1920 0
2424

25+
Glob patterns can be used to match any output of that make and model:
26+
27+
output "Some Company ABC123\*" pos 1920 0
28+
2529
# COMMANDS
2630

2731
*output* <name> mode|resolution|res [--custom] <WIDTHxHEIGHT>[@<RATE>Hz]

0 commit comments

Comments
 (0)