aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/layer_shell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers/layer_shell.rs')
-rw-r--r--src/handlers/layer_shell.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/handlers/layer_shell.rs b/src/handlers/layer_shell.rs
index bd3fbbcd..7862a9fe 100644
--- a/src/handlers/layer_shell.rs
+++ b/src/handlers/layer_shell.rs
@@ -24,11 +24,17 @@ impl WlrLayerShellHandler for State {
_layer: Layer,
namespace: String,
) {
- let output = wl_output
- .as_ref()
- .and_then(Output::from_resource)
- .or_else(|| self.niri.layout.active_output().cloned())
- .unwrap();
+ let output = if let Some(wl_output) = &wl_output {
+ Output::from_resource(wl_output)
+ } else {
+ self.niri.layout.active_output().cloned()
+ };
+ let Some(output) = output else {
+ warn!("no output for new layer surface, closing");
+ surface.send_close();
+ return;
+ };
+
let mut map = layer_map_for_output(&output);
map.map_layer(&LayerSurface::new(surface, namespace))
.unwrap();