Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chaining commandline arguments for multiple monitor #42

Open
folliehiyuki opened this issue Jan 31, 2023 · 4 comments
Open

Chaining commandline arguments for multiple monitor #42

folliehiyuki opened this issue Jan 31, 2023 · 4 comments

Comments

@folliehiyuki
Copy link

folliehiyuki commented Jan 31, 2023

Currently if I want to set different videos for each monitor, I'll have to run multiple mpvpaper commands.

What I want is something like this (basically only 1 mpvpaper command to spawn all the mpv ones):

mpvpaper DP-1 "path/to/video1" DP-2 "path/to/video2"

The obvious benefit here is that I can manage mpvpaper as a user service for more fine-grained control (restart, stop, ...). For context, wlr-rand and swaybg have this design.

@GhostNaN
Copy link
Owner

It is not possible to spawn multiple libmpv render contexts.
This is a hard limitation of mpv :

https://github.com/mpv-player/mpv/blob/88918411f3533e75df0ddce2cdeb25ce55804589/libmpv/render.h#L543-L579
"Currently, only at most 1 context can exists per mpv core (it represents the main video output)."

And spawning multiple mpv cores could get messy real fast for a small convenience.

The obvious benefit here is that I can manage mpvpaper as a user service for more fine-grained control (restart, stop, ...).

Create a shell script to run as a service with forking the program as seen here:

https://unix.stackexchange.com/questions/516749/how-best-to-start-my-systemd-service-to-run-multiple-apps

For context, wlr-rand and swaybg have this design.

wlr-rand is an output manager and has nothing to do with wallpapers.
swaybg just displays an image with cairo

@folliehiyuki
Copy link
Author

It is not possible to spawn multiple libmpv render contexts.
This is a hard limitation of mpv :

https://github.com/mpv-player/mpv/blob/88918411f3533e75df0ddce2cdeb25ce55804589/libmpv/render.h#L543-L579
"Currently, only at most 1 context can exists per mpv core (it represents the main video output)."
And spawning multiple mpv cores could get messy real fast for a small convenience.

Thanks for the explanation! If it is not possible to do due to mpv / not worth implementing, considering the small user cases, you can close the issue.

Create a shell script to run as a service with forking the program as seen here:

https://unix.stackexchange.com/questions/516749/how-best-to-start-my-systemd-service-to-run-multiple-apps

It works but that's not how systemd (or any kinds of service manager) should be used, and there are quite a few trade-offs. It's best to keep 1 service for each process.

My sole reason for this request is for automation, as dynamically managing multiple user services based on the current number of monitors is not practical. Running a one off script to spawn multiple mpvpaper commands just doesn't give me the benefits of using a service manager.

wlr-rand is an output manager and has nothing to do with wallpapers.
swaybg just displays an image with cairo

I only mentioned them as examples of CLI programs with multiple arguments chaining, so we can take reference on how to structure the CLI part (if it ever get implemented). What their functionalities are and how they work doesn't matter. Sorry that the wording was clear there.

@GhostNaN
Copy link
Owner

GhostNaN commented Feb 1, 2023

This request isn't impossible, but it is hacky.
I could make it so that mpvpaper could internally fork the process whenever there are multiple display args (although the terminal output would be ruined).
Doing this any other way wouldn't work, so you're dealing with multiple process of mpvpaper either way.

@GhostNaN
Copy link
Owner

GhostNaN commented Feb 1, 2023

Almost forgot, the --auto-stop -s arg wouldn't be easily compatible with this idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants