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

Errors when running more than one instance of wl-present #51

Closed
danielrainer opened this issue Oct 12, 2024 · 8 comments
Closed

Errors when running more than one instance of wl-present #51

danielrainer opened this issue Oct 12, 2024 · 8 comments
Labels
bug Something isn't working scripts Issues that relate to example scripts and not the wl-mirror binary itself

Comments

@danielrainer
Copy link
Contributor

It seems that wl-present is designed to be used with only a single mirror running. Being able to control multiple mirrors at the same time would be nice, but this can also be done in a more manual way using wl-mirror.

The issue I encountered is that wl-present happily starts up more than one instance, but then fails. How it fails depends on whether pipectl-shim or pipectl is used.

  • When pipectl-shim is used, two mirror instances will run, but only the second one receives subsequent commands (because the pipe opened by the first instance is deleted and recreated).
  • When pipectl is used, the pipectl process fails when it detects that the pipe already exists. During cleanup (in the pipectl process), the existing pipe is deleted (which might also be undesirable behavior). The wl-mirror process then seems to be busy waiting in the event loop. The output is not mirrored and the window is unresponsive.

Ideally, controlling multiple mirrors at the same time could be supported, but this would probably make the application design significantly more complicated. Alternatively, it would be a nice improvement if no second mirror can be started using wl-present if one is already active (e.g. by checking if the named pipe exists).

@Ferdi265 Ferdi265 added bug Something isn't working scripts Issues that relate to example scripts and not the wl-mirror binary itself labels Oct 13, 2024
@Ferdi265
Copy link
Owner

I fixed the underlying issue in pipectl (released as v0.5.1), but wl-present still has to be fixed. IMO it should either work properly with multiple instances, or fail fully (have wl-mirror exit instead of being unresponsive).

Ferdi265 added a commit that referenced this issue Oct 13, 2024
This fixes wl-mirror staying open when its input closes in stream mode.
Previously wl-mirror also hanged in this case as it attempted to read
stdin in response to the EPOLLHUP event.

Partial fix for #51.
@Ferdi265
Copy link
Owner

Partially fixed in 100718b. This, together with pipectl v0.5.1, should fix wl-present when used with pipectl, it now exits cleanly when started a second time instead of creating a second unresponsive wl-mirror instance.

pipectl-shim still needs to be fixed. This isn't as easy as it doesn't detect when the wl-mirror window is closed properly and therefore it's hard to correctly remove the pipe at the right time.

@Ferdi265
Copy link
Owner

Fixed in df1b3ab. pipectl-shim now behaves the same as pipectl for multiple instances. Proper support for multiple instances will be added in a later commit

@Ferdi265
Copy link
Owner

Support for multiple instances implemented in 98f9aab.

@Ferdi265
Copy link
Owner

Documentation for multiple instances now also done.

@danielrainer
Copy link
Contributor Author

Thank you for the quick fix!

Thinking about this I also considered the scenario of wanting to control multiple instances with a single command. It's not something I expect to need, but it might be useful for

  • giving a presentation in a place with multiple outputs intended to allow everyone in the audience a good view. (Although in many cases these places might have handling for this built into the local system.)
  • comparing multiple outputs (e.g. to help with optimizing monitor settings)

Implementing this would be a bit more complicated, since it requires one-to-many communication. One approach which might work is to use the new --name flag to specify a directory (or use a default one) and then for each mirror instance which should be controlled by the same instruction stream create a named pipe in this directory. wl-present could then send the command it receives into all pipes in the corresponding directory.

Would you be interested in such a feature?

@Ferdi265
Copy link
Owner

Thank you for the quick fix!

Thinking about this I also considered the scenario of wanting to control multiple instances with a single command. It's not something I expect to need, but it might be useful for

* giving a presentation in a place with multiple outputs intended to allow everyone in the audience a good view. (Although in many cases these places might have handling for this built into the local system.)

* comparing multiple outputs (e.g. to help with optimizing monitor settings)

Implementing this would be a bit more complicated, since it requires one-to-many communication. One approach which might work is to use the new --name flag to specify a directory (or use a default one) and then for each mirror instance which should be controlled by the same instruction stream create a named pipe in this directory. wl-present could then send the command it receives into all pipes in the corresponding directory.

Would you be interested in such a feature?

I think such features are better off implemented as downstream scripts as they are quite niche.

@Ferdi265
Copy link
Owner

Also: released in v0.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scripts Issues that relate to example scripts and not the wl-mirror binary itself
Projects
None yet
Development

No branches or pull requests

2 participants