oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

Fixed panic caused by double .unwrap() in the event that no windows are opened, but fullscreen is sent.

Commit
93ceb27284508adb70b94393786de8612535f01d
Parent
86b598f
Author
tonybanters <tonybanters@gmail.com>
Date
2025-12-12 22:14:59

Diff

diff --git a/src/window_manager.rs b/src/window_manager.rs
index 1b01d56..4e735c2 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -1420,11 +1420,14 @@ impl WindowManager {
                 .copied()
                 .collect();
 
-            let focused = self
+            let focused = match self
                 .monitors
                 .get(self.selected_monitor)
                 .and_then(|m| m.selected_client)
-                .unwrap();
+            {
+                Some(window) => window,
+                None => return Ok(()),
+            };
 
             self.fullscreen_windows.insert(focused);
 
@@ -1496,11 +1499,14 @@ impl WindowManager {
             }
             self.connection.flush()?;
         } else {
-            let focused = self
+            let focused = match self
                 .monitors
                 .get(self.selected_monitor)
                 .and_then(|m| m.selected_client)
-                .unwrap();
+            {
+                Some(window) => window,
+                None => return Ok(()),
+            };
 
             self.fullscreen_windows.remove(&focused);