Conversation
Move layer_shell_background from a single shared container to per-output containers in OutputWorkspaces. Background layer surfaces are now: - Created per-output and attached to each output's layer tree - Mirrored into every workspace view (above config background, below windows) - Mirrored into every expose window selector (above workspace background mirror) - Pointer events disabled for Background layer surfaces Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The per-output layer_shell_background container is a content source for mirror layers — it should not be rendered directly on the output. Move it to otto_root so it only appears through its workspace and expose mirrors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for rendering wlr-layer-shell background/bottom surfaces on a per-output basis by introducing a per-output background container and mirroring its content into each workspace and the expose (window selector) view.
Changes:
- Add a per-output
layer_shell_backgroundcontainer toOutputWorkspacesand route Background/Bottom layer-shell surfaces into it. - Mirror the per-output background container into each
WorkspaceViewandWindowSelectorViewso backgrounds appear in normal and expose modes. - Update layer-shell surface creation to pass the target
Outputthrough the shell handler intoWorkspaces::create_layer_shell_layer.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/workspaces/workspace.rs | Mirrors the per-output layer-shell background container into each workspace view. |
| src/workspaces/window_selector.rs | Mirrors the per-output layer-shell background container into the expose/window selector view. |
| src/workspaces/mod.rs | Introduces per-output layer_shell_background, updates output mapping, and routes Background/Bottom surfaces by output. |
| src/shell/mod.rs | Passes Output into create_layer_shell_layer when creating new layer-shell surfaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| /// ├── output_layer (per output) | ||
| /// │ ├── layer_shell_background (per-output wlr-layer-shell bg/bottom surfaces) | ||
| /// │ ├── workspaces | ||
| /// │ │ ├── workspace_view_1 | ||
| /// │ │ │ ├── background_view (config-driven) | ||
| /// │ │ │ ├── layer_shell_bg_mirror (mirror: layer_shell_background) | ||
| /// │ │ │ └── workspace_windows_container_1 |
There was a problem hiding this comment.
The layer diagram shows layer_shell_background as a direct child of each output_layer, but the implementation attaches layer_shell_background to the global scene root (so it is not rendered directly). Please update the diagram (or the parent attachment logic) so the documented tree matches the actual scene graph; otherwise it will mislead future changes/debugging around z-order and hit-testing.
| size: taffy::Size { | ||
| width: taffy::Dimension::Percent(1.0), | ||
| height: taffy::Dimension::Percent(1.0), | ||
| }, |
There was a problem hiding this comment.
layer_shell_background is described as per-output, but it is sized as 100% of the scene root (via Percent(1.0)). Since the scene root size can span multiple outputs, this makes the container bounds depend on the total virtual layout rather than the target output, which can inflate render bounds and potentially affect how as_content() is sampled in mirrors. Consider sizing this layer to the output’s physical dimensions (and updating it on output resize) to keep bounds output-local.
| size: taffy::Size { | |
| width: taffy::Dimension::Percent(1.0), | |
| height: taffy::Dimension::Percent(1.0), | |
| }, |
| WlrLayer::Background | WlrLayer::Bottom => { | ||
| if let Some(ows) = self.output_workspaces.get(&output.name()) { | ||
| ows.layer_shell_background.set_hidden(false); | ||
| ows.layer_shell_background.add_sublayer(&layer); |
There was a problem hiding this comment.
create_layer_shell_layer silently drops Background/Bottom surfaces if output_workspaces has no entry for the provided output (the layer is created but never attached to any container). This can lead to invisible layer-shell surfaces and hard-to-debug state if a surface is created during output hotplug or for an output that hasn’t been mapped yet. Consider making this an explicit error path (e.g., warn/log and fall back to a known output’s container, or ensure the output is mapped/created before returning).
| ows.layer_shell_background.add_sublayer(&layer); | |
| ows.layer_shell_background.add_sublayer(&layer); | |
| } else { | |
| eprintln!( | |
| "Workspaces::create_layer_shell_layer: no output_workspaces entry for \ | |
| output '{}' when creating {:?} layer; layer-shell surface may not be \ | |
| visible", | |
| output.name(), | |
| wlr_layer, | |
| ); |
No description provided.