gardesk/gar / 7056e22

Browse files

Fix session exit cleanup: unmap windows and kill picom

- Remove glx-no-rebind-pixmap from picom config (prevents wallpaper change detection)
- Unmap all managed windows before exit so they don't persist on X server
- Kill picom on exit to prevent compositor effects bleeding into greeter
- Add sync to ensure X server processes unmap requests before exit
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
7056e221e89346e232c830cc767b040c99586d3b
Parents
78c6ca7
Tree
4b3aa69

2 changed files

StatusFile+-
M gar/src/config/mod.rs 0 1
M gar/src/x11/events.rs 21 1
gar/src/config/mod.rsmodified
@@ -251,7 +251,6 @@ backend = "glx";
251251
 vsync = true;
252252
 use-ewmh-active-win = true;
253253
 glx-no-stencil = true;
254
-glx-no-rebind-pixmap = true;
255254
 
256255
 # Rounded Corners
257256
 corner-radius = {};
gar/src/x11/events.rsmodified
@@ -1148,8 +1148,10 @@ impl WindowManager {
11481148
                 self.reload_config()?;
11491149
             }
11501150
             Action::Exit => {
1151
-                tracing::info!("Exit requested");
1151
+                tracing::info!("Exit requested, will exit event loop");
11521152
                 self.running = false;
1153
+                // Force an immediate return from event handling
1154
+                return Ok(());
11531155
             }
11541156
             Action::ToggleFloating => {
11551157
                 if let Some(window) = self.focused_window {
@@ -1743,12 +1745,30 @@ impl WindowManager {
17431745
             std::thread::sleep(std::time::Duration::from_millis(10));
17441746
         }
17451747
 
1748
+        // Unmap all managed windows so they don't persist on the X server
1749
+        // This ensures windows aren't visible when returning to the greeter
1750
+        tracing::info!("Unmapping {} managed windows", self.windows.len());
1751
+        for &window in self.windows.keys() {
1752
+            tracing::debug!("Unmapping window {}", window);
1753
+            let _ = self.conn.conn.unmap_window(window);
1754
+        }
1755
+        // Sync to ensure X server processes all unmap requests before we exit
1756
+        let _ = self.conn.sync();
1757
+        tracing::info!("Windows unmapped and synced");
1758
+
17461759
         // Stop garbar if it was spawned
17471760
         if let Some(ref mut child) = self.garbar_process {
17481761
             stop_garbar(child);
17491762
         }
17501763
         self.garbar_process = None;
17511764
 
1765
+        // Kill picom to prevent compositor effects from bleeding into the greeter
1766
+        tracing::info!("Killing picom...");
1767
+        let _ = std::process::Command::new("pkill")
1768
+            .arg("-x")
1769
+            .arg("picom")
1770
+            .status();
1771
+
17521772
         // Signal systemd that graphical session has ended
17531773
         // This stops user services bound to graphical-session.target (like garbg)
17541774
         stop_graphical_session();