git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit99d07dbc5d90b9a574d08c21c126290ef226eb1b
parentce9274bd62
authorLucas Galante <[email protected]>
date2026-06-26 22:17
fix: check surfaces window_opacity prior to legacy layout-level fallback keys in active_backplate_opacity

 src/color.rs | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/color.rs b/src/color.rs
index f09cbfa..306d99f 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -582,6 +582,13 @@ pub fn active_backplate_opacity() -> f32 {
         return opacity as f32;
     }
 
+    // Modern surfaces fallback:
+    if let Some(opacity) = val.pointer("/surfaces/backplate_opacity")
+        .or_else(|| val.pointer("/surfaces/window_opacity"))
+        .and_then(|v| v.as_f64()) {
+        return opacity as f32;
+    }
+
     // Fallback to legacy key:
     let legacy_key = match mode.as_str() {
         "fullscreen" => "fullscreen_opacity",
@@ -605,13 +612,7 @@ pub fn active_backplate_opacity() -> f32 {
         "floating_backplate_opacity" | "floating_opacity" => 0.9,
         "pinned_backplate_opacity" | "pinned_opacity" => 0.05,
         "popup_backplate_opacity" | "popup_opacity" => 0.20,
-        _ => {
-            val.pointer("/surfaces/backplate_opacity")
-                .or_else(|| val.pointer("/surfaces/window_opacity"))
-                .and_then(|v| v.as_f64())
-                .map(|v| v as f32)
-                .unwrap_or(0.9)
-        }
+        _ => 0.9,
     }
 }