pop-os / cosmic-workspaces-epoch

GNU General Public License v3.0
17 stars 11 forks source link

Sync background with cosmic-bg #24

Open ids1024 opened 2 months ago

ids1024 commented 2 months ago

Currently a static image path is used for the background of the workspaces view.

Like the screenshot UI in xdg-desktop-portal-cosmic (which should probably share more code with cosmic-workspaces), this should use cosmic-bg-config to show the correct background.

Or the compositor could provide a way to capture just the background. (Which would also work if someone wanted to use some fancy animated background instead of cosmic-bg, etc.)

ids1024 commented 2 months ago

https://github.com/pop-os/cosmic-workspaces-epoch/commit/d759e1d7c2e8a356a5a6ff08a83cc7976e160b3d adds this, but the scaling doesn't quite match cosmic-bg. And it seems to have some impact on the time it takes to open cosmic-workspaces, which needs some optimization.

Drakulix commented 2 months ago

The scaling is indeed quite computationally intensive, it is only bare-able for release builds of cosmic-bg. (It would be nice to do this on the gpu or offload this to the compositor with some scaling-protocol.)

I wonder, if we should just hack this in cosmic-comp, so there can't be any mismatches in the background at all.

E.g. we could skip any window rendering, if we have a layer-surface with the cosmic-workspaces id. (or add this as an option to the cosmic-workspaces protocol.)

ids1024 commented 1 month ago

I think the performance issue here is Iced reading and parsing the image file then uploading it to a GPU texture. I think that could be improved by using an image Handle that contains the pixel data instead of letting Iced load it from disk; though I think there's no way to prevent iced_wgpu from evicting it from the GPU. Scaling itself shouldn't be a problem as long as the wgpu renderer is used.

That idea for cosmic-comp to handle this is interesting. If a bit hacky. I was thinking of a capture source specifically for capturing the background layer. But instead disabling rendering of non-layer surfaces could work. I think that would behave as expected, at least with the cosmic-epoch layer surfaces we have currently.

It could behave in an unexpected way with other features we might add, or third-party layer shell clients. For instance it would be odd if something was showing desktop icons.