Skip to content

Commit

Permalink
Allow all glob patterns in output configs
Browse files Browse the repository at this point in the history
Instead of special casing "output * ..." just make output take all glob
patterns.
  • Loading branch information
pedrocr committed Sep 2, 2020
1 parent 7636a0f commit 452a27c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sway/config/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
10 changes: 7 additions & 3 deletions sway/sway-output.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]
Expand Down

0 comments on commit 452a27c

Please sign in to comment.