gardesk/gar / a880f57

Browse files

fix: map windows on any visible workspace, not just focused

Authored by espadonne
SHA
a880f57723b0577b852f7194a12258c6cd01c31e
Parents
c7ea6ce
Tree
1fd5482

1 changed file

StatusFile+-
M gar/src/x11/events.rs 17 17
gar/src/x11/events.rsmodified
@@ -519,27 +519,27 @@ impl WindowManager {
519519
         self.conn.grab_button(window)?;
520520
 
521521
         // Manage window on target workspace
522
-        if target_idx != self.focused_workspace {
523
-            // Window goes to a different workspace
524
-            if should_float {
525
-                self.manage_window_floating_on_workspace(window, target_idx);
522
+        let target_visible = self.is_workspace_visible(target_idx);
523
+
524
+        if should_float {
525
+            if target_idx == self.focused_workspace {
526
+                self.manage_window_floating(window);
526527
             } else {
527
-                self.manage_window_on_workspace(window, target_idx);
528
+                self.manage_window_floating_on_workspace(window, target_idx);
528529
             }
529
-            // Create frame if title bars enabled
530
-            self.create_frame_for_window(window);
531
-            // Don't map - it's on another workspace
532530
         } else {
533
-            // Window goes to current workspace
534
-            if should_float {
535
-                self.manage_window_floating(window);
536
-            } else {
531
+            if target_idx == self.focused_workspace {
537532
                 self.manage_window(window);
533
+            } else {
534
+                self.manage_window_on_workspace(window, target_idx);
538535
             }
539
-            // Create frame if title bars enabled
540
-            let frame = self.create_frame_for_window(window);
536
+        }
537
+
538
+        // Create frame if title bars enabled
539
+        let frame = self.create_frame_for_window(window);
541540
 
542
-            // Map the window (and frame if present)
541
+        // Map window if it's on a visible workspace (any monitor)
542
+        if target_visible {
543543
             if frame.is_some() {
544544
                 self.frames.map_frame(&self.conn.conn, window)?;
545545
             }
@@ -549,8 +549,8 @@ impl WindowManager {
549549
         // Apply layout to all windows
550550
         self.apply_layout()?;
551551
 
552
-        // Focus the new window (only if on current workspace)
553
-        if target_idx == self.focused_workspace {
552
+        // Focus the new window if on a visible workspace
553
+        if target_visible {
554554
             self.set_focus(window, true)?;
555555
         }
556556