jay icon indicating copy to clipboard operation
jay copied to clipboard

portal screensharing a background workspace/window

Open kotarac opened this issue 10 months ago • 6 comments

I've noticed background workspaces/windows don't get updated when screensharing.

From a quick look in the implementation, I see multiple visibility checks, so I assume this is intentional.

Is this by design or just left to be implemented later?

kotarac avatar Feb 01 '26 10:02 kotarac

Surfaces that are invisible don't receive any frame callbacks so they would likely not update anyway.

mahkoh avatar Feb 01 '26 11:02 mahkoh

Surfaces that are invisible don't receive any frame callbacks so they would likely not update anyway.

Yep. Some plumbing would need to be done to make sure they get frame callbacks if they're being captured.

What I'm wondering if that's by design, if it would make sense at all to try to implement that and if there's any drawbacks I'm not aware of. Not sure how other compositors handle this.

TL;DR just a sanity check if this makes sense at all. 🙂

kotarac avatar Feb 01 '26 12:02 kotarac

What I'm wondering if that's by design, if it would make sense at all to try to implement that and if there's any drawbacks I'm not aware of.

There are a few things that would need to be done:

  1. Decide when to capture: Currently this is being driven by damage on the output. But surfaces that are not visible don't cause any damage and visible surfaces might cause damage even if the workspace in the background is unchanged.
  2. Decide when to send frame callbacks: If an element of a tree is being captured, a flag would have to be set in all of its children that informs them of this. Then, wl_surface could know that it needs to subscribe to vsync events even if it is hidden.

mahkoh avatar Feb 01 '26 12:02 mahkoh

There are a few things that would need to be done:

  1. Decide when to capture: Currently this is being driven by damage on the output. But surfaces that are not visible don't cause any damage and visible surfaces might cause damage even if the workspace in the background is unchanged.
  2. Decide when to send frame callbacks: If an element of a tree is being captured, a flag would have to be set in all of its children that informs them of this. Then, wl_surface could know that it needs to subscribe to vsync events even if it is hidden.

Got it. You wouldn't be opposed to this being done?

I have a couple of usecases for it (various meeting and demoing scenarios), but it's not a dealbreaker and there are workarounds.

kotarac avatar Feb 01 '26 12:02 kotarac

Got it. You wouldn't be opposed to this being done?

If you can find an elegant way to do it.

mahkoh avatar Feb 01 '26 12:02 mahkoh

For anyone trying to implement this, wlroots/hyprland supports this, so its method could be looked at

GK-Gaming avatar May 18 '26 15:05 GK-Gaming