git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit594bf3568a021a384c53273f2266707051a3c56d
parentf34f904ea9
authorLucas Galante <[email protected]>
date2026-05-23 20:43
focus: prevent clear-notifier from auto-focusing on spawn

 src/borders.rs     | 11 ++++++++---
 src/decorations.rs | 14 +++++++++++---
 src/wayland.rs     |  2 +-
 src/wm.rs          |  7 ++++---
 4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/borders.rs b/src/borders.rs
index c0f82b7..8c7c69b 100644
--- a/src/borders.rs
+++ b/src/borders.rs
@@ -68,7 +68,6 @@ pub fn compute_border_colors(state: &WindowManager) -> Vec<WindowBorders> {
         .filter(|(_, w)| (w.tags & state.active_tags) != 0 && !w.closed)
         .map(|(i, _)| i)
         .collect();
-    let n_visible = visible.len();
 
     for (idx, win) in state.windows.iter().enumerate() {
         if (win.tags & state.active_tags) == 0 {
@@ -95,8 +94,14 @@ pub fn compute_border_colors(state: &WindowManager) -> Vec<WindowBorders> {
             )
         } else {
             // Unfocused window: blend background → border based on depth
-            let pos = visible.iter().position(|&i| i == idx).unwrap_or(0);
-            let depth = (n_visible - 1 - pos) as i32;
+            let visible_mode: Vec<usize> = visible
+                .iter()
+                .cloned()
+                .filter(|&i| state.windows[i].tiling_mode == win.tiling_mode)
+                .collect();
+            let n_visible_mode = visible_mode.len();
+            let pos = visible_mode.iter().position(|&i| i == idx).unwrap_or(0);
+            let depth = (n_visible_mode - 1 - pos) as i32;
             let mut factor = 1.0_f64;
             for _ in 0..depth {
                 factor *= UNFOCUSED_DEPTH_FACTOR;
diff --git a/src/decorations.rs b/src/decorations.rs
index b5328dc..a73219a 100644
--- a/src/decorations.rs
+++ b/src/decorations.rs
@@ -205,12 +205,20 @@ pub fn update_decorations(state: &mut AppState, qhandle: &QueueHandle<AppState>)
             let title = w.title.clone().unwrap_or_else(|| {
                 w.app_id.clone().unwrap_or_else(|| "Window".to_string())
             });
-            let layout_idx = state.wm.windows
+            let mode_idx = state.wm.windows
                 .iter()
-                .filter(|win| !win.closed && win.app_id.as_deref() != Some("clear-status-interface"))
+                .filter(|win| !win.closed && win.app_id.as_deref() != Some("clear-status-interface") && (win.tags & active_tags) != 0 && win.tiling_mode == w.tiling_mode)
                 .position(|win| win.id == w.id)
                 .unwrap_or(0);
-            let title_with_idx = format!("[{}] {}", layout_idx, title);
+            let indicator = match w.tiling_mode {
+                crate::types::TilingMode::Floating => "F",
+                crate::types::TilingMode::Cascade => "C",
+                crate::types::TilingMode::Grid => "G",
+                crate::types::TilingMode::Vsplit => "V",
+                crate::types::TilingMode::Hsplit => "H",
+                crate::types::TilingMode::Fullscreen => "S",
+            };
+            let title_with_idx = format!("[{}{}] {}", indicator, mode_idx, title);
 
             // Find matching computed border color for this window
             let bc = border_colors.iter().find(|b| b.window_idx == idx);
diff --git a/src/wayland.rs b/src/wayland.rs
index 642710b..75bb5dc 100644
--- a/src/wayland.rs
+++ b/src/wayland.rs
@@ -675,7 +675,7 @@ impl Dispatch<RiverWindowManagerV1, ()> for AppState {
                         .wm
                         .windows
                         .iter()
-                        .filter(|w| w.is_new && !w.closed && (w.tags & active_tags) != 0 && w.app_id.as_deref() != Some("clear-status-interface"))
+                        .filter(|w| w.is_new && !w.closed && (w.tags & active_tags) != 0 && w.app_id.as_deref() != Some("clear-status-interface") && w.app_id.as_deref() != Some("clear-notifier"))
                         .map(|w| w.id)
                         .last();
                     if let Some(new_id) = new_focused_id {
diff --git a/src/wm.rs b/src/wm.rs
index 1fffced..8467e1f 100644
--- a/src/wm.rs
+++ b/src/wm.rs
@@ -281,6 +281,7 @@ fn compute_tiling(
     let mut idx_grid = 0i32;
     let mut idx_vsplit = 0i32;
     let mut idx_hsplit = 0i32;
+    let mut idx_floating = 0i32;
 
     for win in &wm.windows {
         if (win.tags & wm.active_tags) == 0 || win.closed {
@@ -375,14 +376,14 @@ fn compute_tiling(
                 let fx = if win.x != 0 || win.y != 0 {
                     win.x
                 } else {
-                    gap_left + fbw + cascade_offset * idx_cascade
+                    gap_left + fbw + cascade_offset * idx_floating
                 };
                 let fy = if win.x != 0 || win.y != 0 {
                     win.y
                 } else {
-                    gap_left + fbw + bar_height + gap_top + cascade_offset * idx_cascade
+                    gap_left + fbw + bar_height + gap_top + cascade_offset * idx_floating
                 };
-                idx_cascade += 1;
+                idx_floating += 1;
                 (fx, fy, fw, fh)
             }
         };