Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Support transparency toggle from settings config
protocol/clear-inspector-v1.xml | 4 ++--
src/server/config.rs | 10 ++++++++++
src/server/inspector.rs | 2 +-
src/server/window_manager.rs | 14 ++++++++++----
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/protocol/clear-inspector-v1.xml b/protocol/clear-inspector-v1.xml
index 4dca611..abefd7f 100644
--- a/protocol/clear-inspector-v1.xml
+++ b/protocol/clear-inspector-v1.xml
@@ -6,7 +6,7 @@
<interface name="zclear_inspector_v1" version="1">
<description summary="query information about client surface states and layouts">
- This interface allows clear-ui client applications to register their surfaces
+ This interface allows cce-ui client applications to register their surfaces
and publish their internal widget trees and state to the compositor.
It also allows inspector tools to request the list of active surfaces and their states.
</description>
@@ -16,7 +16,7 @@
</request>
<request name="register_client">
- <description summary="register a wl_surface as a clear-ui client window">
+ <description summary="register a wl_surface as a cce-ui client window">
Associate a client wl_surface with this inspector.
</description>
<arg name="surface" type="object" interface="wl_surface"/>
diff --git a/src/server/config.rs b/src/server/config.rs
index 46ecd1d..bfbdbca 100644
--- a/src/server/config.rs
+++ b/src/server/config.rs
@@ -39,6 +39,7 @@ pub struct Layout {
pub side_panel_border_opacity: i32,
pub status_normal_color: String,
pub low_color: String,
+ pub transparency_opacity: f32,
}
impl Default for Layout {
@@ -76,6 +77,7 @@ impl Default for Layout {
side_panel_border_opacity: 100,
status_normal_color: "#ccccd8".to_string(),
low_color: "#1c2020".to_string(),
+ transparency_opacity: 0.9,
}
}
}
@@ -214,6 +216,11 @@ pub struct InputConfig {
pub trackpoint_accel_profile: Option<String>,
}
+#[derive(Debug, Deserialize, Clone, Default)]
+pub struct TransparencyConfig {
+ pub opacity: Option<f64>,
+}
+
#[derive(Debug, Deserialize)]
pub struct Config {
#[serde(default)]
@@ -238,6 +245,8 @@ pub struct Config {
pub input: Option<InputConfig>,
#[serde(default)]
pub gesture_bind: Vec<GestureBindConfig>,
+ #[serde(default)]
+ pub transparency: Option<TransparencyConfig>,
}
#[derive(Debug, Deserialize)]
@@ -650,6 +659,7 @@ pub fn parse_config(path: &str, state: &mut crate::window_manager::WindowManager
state.layout.side_panel_border_gap = config.layout.side_panel_border_gap as i32;
state.layout.side_panel_border_opacity = config.layout.side_panel_border_opacity as i32;
state.layout.status_normal_color = config.layout.status_normal_color.clone();
+ state.layout.transparency_opacity = config.transparency.as_ref().and_then(|t| t.opacity).unwrap_or(0.9) as f32;
for (key, val) in &config.env {
let expanded = expand_env_vars(val);
diff --git a/src/server/inspector.rs b/src/server/inspector.rs
index 71171d1..0051217 100644
--- a/src/server/inspector.rs
+++ b/src/server/inspector.rs
@@ -203,7 +203,7 @@ unsafe extern "C" fn inspector_get_inspected_surfaces(
std::ffi::CStr::from_ptr(app_id_ptr).to_owned()
};
- if let Some((fd, len)) = create_memfd_with_data("clear_ui_inspected_state", state.as_bytes()) {
+ if let Some((fd, len)) = create_memfd_with_data("cce_ui_inspected_state", state.as_bytes()) {
// Send: inspected_surface(title, app_id, x, y, width, height, fd, len)
// Event inspected_surface has index 0
ffi::wl_resource_post_event(
diff --git a/src/server/window_manager.rs b/src/server/window_manager.rs
index db59f5f..8ed97c6 100644
--- a/src/server/window_manager.rs
+++ b/src/server/window_manager.rs
@@ -928,7 +928,9 @@ impl WindowManager {
};
(*win_ptr).rendering_requested.blur = self.layout.window_blur;
- (*win_ptr).rendering_requested.opacity = if is_focused { 1.0f32 } else { 0.85f32 };
+ (*win_ptr).rendering_requested.opacity = if is_focused { 1.0f32 } else {
+ if self.layout.transparency_opacity >= 1.0 { 1.0f32 } else { 0.85f32 }
+ };
}
let g = self.layout.side_panel_border_gap;
@@ -957,7 +959,7 @@ impl WindowManager {
(*win_ptr).wm_requested.tiled = 1 | 2 | 4 | 8;
(*win_ptr).wm_requested.ssd = true;
- let opacity_factor = self.layout.side_panel_border_opacity as f32 / 100.0;
+ let opacity_factor = if self.layout.transparency_opacity >= 1.0 { 1.0f32 } else { self.layout.side_panel_border_opacity as f32 / 100.0 };
let is_focused = win_ptr == focused_window;
let r = self.layout.border_r;
let g_color = self.layout.border_g;
@@ -973,7 +975,9 @@ impl WindowManager {
a,
};
(*win_ptr).rendering_requested.blur = self.layout.window_blur;
- (*win_ptr).rendering_requested.opacity = if is_focused { 1.0f32 } else { 0.85f32 * opacity_factor };
+ (*win_ptr).rendering_requested.opacity = if is_focused { 1.0f32 } else {
+ if self.layout.transparency_opacity >= 1.0 { 1.0f32 } else { 0.85f32 * opacity_factor }
+ };
} else {
floating_windows.push(win_ptr);
}
@@ -996,7 +1000,9 @@ impl WindowManager {
a,
};
(*win_ptr).rendering_requested.blur = self.layout.window_blur;
- (*win_ptr).rendering_requested.opacity = if is_focused { 1.0f32 } else { 0.90f32 };
+ (*win_ptr).rendering_requested.opacity = if is_focused { 1.0f32 } else {
+ if self.layout.transparency_opacity >= 1.0 { 1.0f32 } else { 0.90f32 }
+ };
if (*win_ptr).tiling_mode == crate::tiling::TilingMode::Popup {
let hint_min_w = (*win_ptr).wm_scheduled.dimensions_hint.min_width as i32;