Skip to content

Commit

Permalink
Configurable window decorations (zed-industries#13866)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mrnugget authored Jul 5, 2024
1 parent 9b7bc04 commit fa60200
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 0 additions & 2 deletions crates/workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand Down
7 changes: 6 additions & 1 deletion crates/zed/src/zed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ pub fn build_window_options(display_uuid: Option<Uuid>, 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 {
Expand All @@ -105,7 +110,7 @@ pub fn build_window_options(display_uuid: Option<Uuid>, 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),
Expand Down

0 comments on commit fa60200

Please sign in to comment.