diff options
author | Manuel Stoeckl <code@mstoeckl.com> | 2022-09-10 16:29:34 -0400 |
---|---|---|
committer | Manuel Stoeckl <code@mstoeckl.com> | 2022-09-10 17:01:12 -0400 |
commit | ba31b5d2c0e6fb3b5fba6bcf250cec2aa542ebbb (patch) | |
tree | cfee53abda47fe4fbd0a649d856c511d62375053 | |
parent | 232b4fd9217e13fd1ba4ad4229b2d4ec63d087d7 (diff) |
Match any name if output = '*'
This commit also fixes an issue where a second xdg_output::done would
mistakenly destroy outputs.
-rw-r--r-- | mpvpaper.man | 5 | ||||
-rw-r--r-- | src/holder.c | 6 | ||||
-rw-r--r-- | src/main.c | 6 |
3 files changed, 13 insertions, 4 deletions
diff --git a/mpvpaper.man b/mpvpaper.man index 217c360..d6cb1cb 100644 --- a/mpvpaper.man +++ b/mpvpaper.man @@ -54,6 +54,11 @@ Simple example: mpvpaper DP-2 /path/to/video .RE +To play the same video on all outputs: +.RS +mpvpaper '*' /path/to/video +.RE + Forward mpv options by passing "--mpv-options" or "-o" like so: .RS mpvpaper -o "no-audio --loop-playlist shuffle" HDMI-A-1 www.url/to/playlist diff --git a/src/holder.c b/src/holder.c index 3fb0f2c..75e8f51 100644 --- a/src/holder.c +++ b/src/holder.c @@ -210,10 +210,12 @@ static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output struct display_output *output = data; - if (strcmp(output->name, output->state->monitor) == 0 && !output->layer_surface) { + bool name_ok = (strcmp(output->name, output->state->monitor) == 0) || + (strcmp(output->state->monitor, "*") == 0); + if (name_ok && !output->layer_surface) { create_layer_surface(output); } - else { + if (!name_ok) { destroy_display_output(output); } } @@ -737,12 +737,14 @@ static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output struct display_output *output = data; - if (strcmp(output->name, output->state->monitor) == 0 && !output->layer_surface) { + bool name_ok = (strcmp(output->name, output->state->monitor) == 0) || + (strcmp(output->state->monitor, "*") == 0); + if (name_ok && !output->layer_surface) { if (VERBOSE) cflp_info("Output %s (%s) selected", output->name, output->identifier); create_layer_surface(output); } - else { + if (!name_ok) { if (VERBOSE) cflp_warning("Output %s (%s) not selected", output->name, output->identifier); destroy_display_output(output); |