From 706372fe4eb64e52274012af6f18f42065bcc509 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:59:27 +0100 Subject: [PATCH] title_bar: Add show_user_picture setting to let users hide their profile picture (#21526) Fixes #21464 Closes #21464 Release Notes: - Added `show_user_picture` setting (default: true) to allow users to hide their profile picture in titlebar. --- assets/settings/default.json | 2 ++ crates/title_bar/Cargo.toml | 1 + crates/title_bar/src/title_bar.rs | 7 ++++++- crates/workspace/src/workspace_settings.rs | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 97e05c9ad5..db3b7130e0 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -1187,6 +1187,8 @@ // "W": "workspace::Save" // } "command_aliases": {}, + // Whether to show user picture in titlebar. + "show_user_picture": true, // ssh_connections is an array of ssh connections. // You can configure these from `project: Open Remote` in the command palette. // Zed's ssh support will pull configuration from your ~/.ssh too. diff --git a/crates/title_bar/Cargo.toml b/crates/title_bar/Cargo.toml index 0a2878b357..9d2fb598fa 100644 --- a/crates/title_bar/Cargo.toml +++ b/crates/title_bar/Cargo.toml @@ -37,6 +37,7 @@ project.workspace = true remote.workspace = true rpc.workspace = true serde.workspace = true +settings.workspace = true smallvec.workspace = true story = { workspace = true, optional = true } theme.workspace = true diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 4e9a99433a..b6e08e2126 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -19,6 +19,7 @@ use gpui::{ }; use project::{Project, RepositoryEntry}; use rpc::proto; +use settings::Settings as _; use smallvec::SmallVec; use std::sync::Arc; use theme::ActiveTheme; @@ -600,7 +601,11 @@ impl TitleBar { .child( h_flex() .gap_0p5() - .child(Avatar::new(user.avatar_uri.clone())) + .children( + workspace::WorkspaceSettings::get_global(cx) + .show_user_picture + .then(|| Avatar::new(user.avatar_uri.clone())), + ) .child( Icon::new(IconName::ChevronDown) .size(IconSize::Small) diff --git a/crates/workspace/src/workspace_settings.rs b/crates/workspace/src/workspace_settings.rs index 0d872425c1..b27a09c24c 100644 --- a/crates/workspace/src/workspace_settings.rs +++ b/crates/workspace/src/workspace_settings.rs @@ -19,6 +19,7 @@ pub struct WorkspaceSettings { pub when_closing_with_no_tabs: CloseWindowWhenNoItems, pub use_system_path_prompts: bool, pub command_aliases: HashMap, + pub show_user_picture: bool, } #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] @@ -128,6 +129,10 @@ pub struct WorkspaceSettingsContent { /// /// Default: true pub command_aliases: Option>, + /// Whether to show user avatar in the title bar. + /// + /// Default: true + pub show_user_picture: Option, } #[derive(Deserialize)]