gardesk/garterm / 8d93a2b

Browse files

feat: dim inactive panes, add blue accent bar on active tab

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
8d93a2b29898d1a266c3b8e888ea7d64795b7af6
Parents
2ed0160
Tree
f0cd17b

1 changed file

StatusFile+-
M garterm/src/render/mod.rs 41 0
garterm/src/render/mod.rsmodified
@@ -468,6 +468,11 @@ impl Renderer {
468468
                 self.add_pane_border(pane.x, pane.y, pane.width, pane.height, pane.focused);
469469
             }
470470
 
471
+            // Dim inactive panes with a semi-transparent overlay
472
+            if !pane.focused && panes.len() > 1 {
473
+                self.add_dim_overlay(pane.x, pane.y, pane.width, pane.height);
474
+            }
475
+
471476
             tracing::trace!(
472477
                 "Pane {} at ({}, {}) size {}x{} focused={}",
473478
                 i, pane.x, pane.y, pane.width, pane.height, pane.focused
@@ -557,6 +562,19 @@ impl Renderer {
557562
                 0.0,
558563
             );
559564
 
565
+            // Active tab accent indicator (colored bar at bottom)
566
+            if tab.is_active {
567
+                let accent_height = 3.0;
568
+                let accent_color = [0.4, 0.6, 1.0, 1.0]; // Blue accent matching focused pane border
569
+                self.add_quad(
570
+                    to_ndc_x(tab.rect.x), to_ndc_y(tab.rect.y + tab.rect.height - accent_height),
571
+                    to_ndc_x(tab.rect.x + tab.rect.width), to_ndc_y(tab.rect.y + tab.rect.height),
572
+                    0.0, 0.0, 0.0, 0.0,
573
+                    accent_color,
574
+                    0.0,
575
+                );
576
+            }
577
+
560578
             // Tab title text (render each character using configured color)
561579
             self.render_text_at(
562580
                 &tab.title,
@@ -714,6 +732,11 @@ impl Renderer {
714732
                 self.add_pane_border(pane.x, pane.y, pane.width, pane.height, pane.focused);
715733
             }
716734
 
735
+            // Dim inactive panes with a semi-transparent overlay
736
+            if !pane.focused && panes.len() > 1 {
737
+                self.add_dim_overlay(pane.x, pane.y, pane.width, pane.height);
738
+            }
739
+
717740
             // Show scroll indicator when scrolled back from bottom
718741
             if pane.terminal.is_scrolled() {
719742
                 self.add_scroll_indicator(pane.x, pane.y, pane.width, pane.height);
@@ -831,6 +854,24 @@ impl Renderer {
831854
         );
832855
     }
833856
 
857
+    /// Add a semi-transparent dark overlay to dim inactive panes
858
+    fn add_dim_overlay(&mut self, x: u32, y: u32, width: u32, height: u32) {
859
+        let (surface_w, surface_h) = self.gpu.size();
860
+        let to_ndc_x = |px: f32| (px / surface_w as f32) * 2.0 - 1.0;
861
+        let to_ndc_y = |py: f32| 1.0 - (py / surface_h as f32) * 2.0;
862
+
863
+        // Semi-transparent black overlay to dim the pane
864
+        let dim_color = [0.0, 0.0, 0.0, 0.35];
865
+
866
+        self.add_quad(
867
+            to_ndc_x(x as f32), to_ndc_y(y as f32),
868
+            to_ndc_x((x + width) as f32), to_ndc_y((y + height) as f32),
869
+            0.0, 0.0, 0.0, 0.0,
870
+            dim_color,
871
+            0.0,
872
+        );
873
+    }
874
+
834875
     /// Add a visual indicator when the terminal is scrolled up from the bottom.
835876
     /// Shows a small down arrow or bar at the bottom-right to indicate more content below.
836877
     fn add_scroll_indicator(&mut self, x: u32, y: u32, width: u32, height: u32) {