From fa602001e3d6c2f668f27d8ed56bbcf74bf6931d Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Fri, 5 Jul 2024 16:54:33 +0200 Subject: [PATCH] Configurable window decorations (#13866) Introduces the `ZED_WINDOW_DECORATIONS` env variable. - Not set, defaulting to client-side decorations - Value is "client": client-side decorations - Value is "server": server-side decorations I think it's good to have this escape-hatch next to all possible detection mechanisms. Release Notes: - N/A --- crates/workspace/src/workspace.rs | 2 -- crates/zed/src/zed.rs | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index c8bcd2c99320b..ba8476fbb4aaa 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -6491,8 +6491,6 @@ pub fn client_side_decorations(element: impl IntoElement, cx: &mut WindowContext cx.set_client_inset(theme::CLIENT_SIDE_DECORATION_SHADOW); } - println!("decorations: {:?}", decorations); - struct GlobalResizeEdge(ResizeEdge); impl Global for GlobalResizeEdge {} diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 48009666f7c7b..3bd98963f9d5f 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -90,6 +90,11 @@ pub fn build_window_options(display_uuid: Option, cx: &mut AppContext) -> .find(|display| display.uuid().ok() == Some(uuid)) }); let app_id = ReleaseChannel::global(cx).app_id(); + let window_decorations = match std::env::var("ZED_WINDOW_DECORATIONS") { + Ok(val) if val == "server" => gpui::WindowDecorations::Server, + Ok(val) if val == "client" => gpui::WindowDecorations::Client, + _ => gpui::WindowDecorations::Client, + }; WindowOptions { titlebar: Some(TitlebarOptions { @@ -105,7 +110,7 @@ pub fn build_window_options(display_uuid: Option, cx: &mut AppContext) -> display_id: display.map(|display| display.id()), window_background: cx.theme().window_background_appearance(), app_id: Some(app_id.to_owned()), - window_decorations: Some(gpui::WindowDecorations::Client), + window_decorations: Some(window_decorations), window_min_size: Some(gpui::Size { width: px(360.0), height: px(240.0),