@@ -320,6 +320,17 @@ impl WindowManager { |
| 320 | return Ok(()); | 320 | return Ok(()); |
| 321 | } | 321 | } |
| 322 | | 322 | |
| | 323 | + // Check if we intentionally unmapped this window (workspace switch, move, etc.) |
| | 324 | + // If so, decrement the counter and ignore this UnmapNotify |
| | 325 | + if let Some(win) = self.windows.get_mut(&window) { |
| | 326 | + if win.ignore_unmap_count > 0 { |
| | 327 | + win.ignore_unmap_count -= 1; |
| | 328 | + tracing::debug!("Ignoring UnmapNotify for window {} (intentional unmap, count now {})", |
| | 329 | + window, win.ignore_unmap_count); |
| | 330 | + return Ok(()); |
| | 331 | + } |
| | 332 | + } |
| | 333 | + |
| 323 | // Check if this window is on a visible workspace (any monitor's active workspace) | 334 | // Check if this window is on a visible workspace (any monitor's active workspace) |
| 324 | let is_visible = self.windows.get(&window) | 335 | let is_visible = self.windows.get(&window) |
| 325 | .map(|w| self.is_workspace_visible(w.workspace)) | 336 | .map(|w| self.is_workspace_visible(w.workspace)) |
@@ -1069,6 +1080,10 @@ impl WindowManager { |
| 1069 | | 1080 | |
| 1070 | // Hide windows on old workspace | 1081 | // Hide windows on old workspace |
| 1071 | for window in self.workspaces[old_ws].all_windows() { | 1082 | for window in self.workspaces[old_ws].all_windows() { |
| | 1083 | + // Mark as intentional unmap so UnmapNotify handler ignores it |
| | 1084 | + if let Some(win) = self.windows.get_mut(&window) { |
| | 1085 | + win.ignore_unmap_count += 1; |
| | 1086 | + } |
| 1072 | self.conn.unmap_window(window)?; | 1087 | self.conn.unmap_window(window)?; |
| 1073 | // Also unmap frames if present | 1088 | // Also unmap frames if present |
| 1074 | if let Some(frame) = self.frames.frame_for_client(window) { | 1089 | if let Some(frame) = self.frames.frame_for_client(window) { |
@@ -1194,6 +1209,10 @@ impl WindowManager { |
| 1194 | self.conn.map_window(window)?; | 1209 | self.conn.map_window(window)?; |
| 1195 | } else { | 1210 | } else { |
| 1196 | // Target is not visible - hide the window | 1211 | // Target is not visible - hide the window |
| | 1212 | + // Mark as intentional unmap so UnmapNotify handler ignores it |
| | 1213 | + if let Some(win) = self.windows.get_mut(&window) { |
| | 1214 | + win.ignore_unmap_count += 1; |
| | 1215 | + } |
| 1197 | self.conn.unmap_window(window)?; | 1216 | self.conn.unmap_window(window)?; |
| 1198 | if let Some(frame) = self.frames.frame_for_client(window) { | 1217 | if let Some(frame) = self.frames.frame_for_client(window) { |
| 1199 | self.conn.unmap_window(frame)?; | 1218 | self.conn.unmap_window(frame)?; |