Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add wsl specific icon (#38316)
localcc574b943081c1
diff --git a/assets/icons/linux.svg b/assets/icons/linux.svgnew file mode 100644index 00000000000..fc76742a3f2--- /dev/null+++ b/assets/icons/linux.svg@@ -0,0 +1,11 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<g clip-path="url(#clip0_3010_383)">+<path fill-rule="evenodd" clip-rule="evenodd" d="M3.71141 7.06133C3.76141 6.47267 3.78341 5.88133 3.81608 5.29133C4.10416 0.190201 11.896 0.190202 12.1841 5.29133C12.2174 5.898 12.2441 6.50333 12.3067 7.10733C12.6951 7.94202 14.3637 11.6214 13.4134 12.006C13.1894 12.096 12.8041 11.7227 12.3694 11.052C12.207 11.9614 11.7273 12.8132 11.0587 13.4467C11.7441 13.68 12.3334 13.998 12.3334 14.3333C12.3334 14.9176 3.66675 14.9257 3.66675 14.3333C3.66675 13.998 4.25608 13.68 4.94141 13.4467C4.26191 12.803 3.82279 11.9657 3.62408 11.056C3.19075 11.724 2.80608 12.096 2.58341 12.006C1.626 11.6185 3.31478 7.90684 3.71141 7.06133Z" stroke="#7B7B7B" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M6.11822 6.6L7.68822 7.89C7.85822 8.03 8.12822 8.03 8.29822 7.89L9.86822 6.6C10.1382 6.38 9.94822 6 9.56822 6H6.42822C6.04822 6 5.85822 6.38 6.12822 6.6H6.11822Z" fill="#7B7B7B"/>+</g>+<defs>+<clipPath id="clip0_3010_383">+<rect width="16" height="16" fill="white"/>+</clipPath>+</defs>+</svg>diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rsindex f3609f7ea87..0f05e58c27c 100644--- a/crates/icons/src/icons.rs+++ b/crates/icons/src/icons.rs@@ -263,6 +263,7 @@ pub enum IconName {ZedPredictError,ZedPredictUp,ZedXCopilot,+ Linux,}impl IconName {diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rsindex aa0ce7661b2..2fc57a52fcb 100644--- a/crates/recent_projects/src/recent_projects.rs+++ b/crates/recent_projects/src/recent_projects.rs@@ -417,10 +417,13 @@ impl PickerDelegate for RecentProjectsDelegate {SerializedWorkspaceLocation::Local => Icon::new(IconName::Screen).color(Color::Muted).into_any_element(),- SerializedWorkspaceLocation::Remote(_) => {- Icon::new(IconName::Server)- .color(Color::Muted)- .into_any_element()+ SerializedWorkspaceLocation::Remote(options) => {+ Icon::new(match options {+ RemoteConnectionOptions::Ssh { .. } => IconName::Server,+ RemoteConnectionOptions::Wsl { .. } => IconName::Linux,+ })+ .color(Color::Muted)+ .into_any_element()}})})diff --git a/crates/recent_projects/src/remote_connections.rs b/crates/recent_projects/src/remote_connections.rsindex 72e2844d501..8b47cbfc0f0 100644--- a/crates/recent_projects/src/remote_connections.rs+++ b/crates/recent_projects/src/remote_connections.rs@@ -192,6 +192,7 @@ impl Settings for SshSettings {pub struct RemoteConnectionPrompt {connection_string: SharedString,nickname: Option<SharedString>,+ is_wsl: bool,status_message: Option<SharedString>,prompt: Option<(Entity<Markdown>, oneshot::Sender<String>)>,cancellation: Option<oneshot::Sender<()>>,@@ -216,12 +217,14 @@ impl RemoteConnectionPrompt {pub(crate) fn new(connection_string: String,nickname: Option<String>,+ is_wsl: bool,window: &mut Window,cx: &mut Context<Self>,) -> Self {Self {connection_string: connection_string.into(),nickname: nickname.map(|nickname| nickname.into()),+ is_wsl,editor: cx.new(|cx| Editor::single_line(window, cx)),status_message: None,cancellation: None,@@ -350,15 +353,16 @@ impl RemoteConnectionModal {window: &mut Window,cx: &mut Context<Self>,) -> Self {- let (connection_string, nickname) = match connection_options {+ let (connection_string, nickname, is_wsl) = match connection_options {RemoteConnectionOptions::Ssh(options) => {- (options.connection_string(), options.nickname.clone())+ (options.connection_string(), options.nickname.clone(), false)}- RemoteConnectionOptions::Wsl(options) => (options.distro_name.clone(), None),+ RemoteConnectionOptions::Wsl(options) => (options.distro_name.clone(), None, true),};Self {- prompt: cx- .new(|cx| RemoteConnectionPrompt::new(connection_string, nickname, window, cx)),+ prompt: cx.new(|cx| {+ RemoteConnectionPrompt::new(connection_string, nickname, is_wsl, window, cx)+ }),finished: false,paths,}@@ -389,6 +393,7 @@ pub(crate) struct SshConnectionHeader {pub(crate) connection_string: SharedString,pub(crate) paths: Vec<PathBuf>,pub(crate) nickname: Option<SharedString>,+ pub(crate) is_wsl: bool,}impl RenderOnce for SshConnectionHeader {@@ -404,6 +409,11 @@ impl RenderOnce for SshConnectionHeader {(self.connection_string, None)};+ let icon = match self.is_wsl {+ true => IconName::Linux,+ false => IconName::Server,+ };+h_flex().px(DynamicSpacing::Base12.rems(cx)).pt(DynamicSpacing::Base08.rems(cx))@@ -411,7 +421,7 @@ impl RenderOnce for SshConnectionHeader {.rounded_t_sm().w_full().gap_1p5()- .child(Icon::new(IconName::Server).size(IconSize::Small))+ .child(Icon::new(icon).size(IconSize::Small)).child(h_flex().gap_1()@@ -443,6 +453,7 @@ impl Render for RemoteConnectionModal {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl ui::IntoElement {let nickname = self.prompt.read(cx).nickname.clone();let connection_string = self.prompt.read(cx).connection_string.clone();+ let is_wsl = self.prompt.read(cx).is_wsl;let theme = cx.theme().clone();let body_color = theme.colors().editor_background;@@ -461,6 +472,7 @@ impl Render for RemoteConnectionModal {paths: self.paths.clone(),connection_string,nickname,+ is_wsl,}.render(window, cx),)diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rsindex d7e7505851a..1ef9ab671f3 100644--- a/crates/recent_projects/src/remote_servers.rs+++ b/crates/recent_projects/src/remote_servers.rs@@ -288,7 +288,7 @@ impl picker::PickerDelegate for WslPickerDelegate {h_flex().flex_grow().gap_3()- .child(Icon::new(IconName::Server))+ .child(Icon::new(IconName::Linux)).child(v_flex().child(HighlightedLabel::new(matched.string.clone(),matched.positions.clone(),@@ -483,12 +483,14 @@ impl gpui::Render for ProjectPicker {connection_string: connection_string.clone(),paths: Default::default(),nickname: nickname.clone(),+ is_wsl: false,}.render(window, cx),ProjectPickerData::Wsl { distro_name } => SshConnectionHeader {connection_string: distro_name.clone(),paths: Default::default(),nickname: None,+ is_wsl: true,}.render(window, cx),})@@ -799,6 +801,7 @@ impl RemoteServerProjects {RemoteConnectionPrompt::new(connection_options.connection_string(),connection_options.nickname.clone(),+ false,window,cx,)@@ -870,7 +873,13 @@ impl RemoteServerProjects {};let prompt = cx.new(|cx| {- RemoteConnectionPrompt::new(connection_options.distro_name.clone(), None, window, cx)+ RemoteConnectionPrompt::new(+ connection_options.distro_name.clone(),+ None,+ true,+ window,+ cx,+ )});let connection = connect(ConnectionIdentifier::setup(),@@ -1644,6 +1653,7 @@ impl RemoteServerProjects {connection_string: connection.host.clone().into(),paths: Default::default(),nickname: connection.nickname.clone().map(|s| s.into()),+ is_wsl: false,}.render(window, cx).into_any_element(),@@ -1651,6 +1661,7 @@ impl RemoteServerProjects {connection_string: connection.distro_name.clone().into(),paths: Default::default(),nickname: None,+ is_wsl: true,}.render(window, cx).into_any_element(),@@ -1988,6 +1999,7 @@ impl RemoteServerProjects {connection_string,paths: Default::default(),nickname,+ is_wsl: false,}.render(window, cx),)diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rsindex 129b5645641..9f00b0ffeff 100644--- a/crates/title_bar/src/title_bar.rs+++ b/crates/title_bar/src/title_bar.rs@@ -349,10 +349,11 @@ impl TitleBar {let options = self.project.read(cx).remote_connection_options(cx)?;let host: SharedString = options.display_name().into();- let nickname = if let RemoteConnectionOptions::Ssh(options) = options {- options.nickname.map(|nick| nick.into())- } else {- None+ let (nickname, icon) = match options {+ RemoteConnectionOptions::Ssh(options) => {+ (options.nickname.map(|nick| nick.into()), IconName::Server)+ }+ RemoteConnectionOptions::Wsl(_) => (None, IconName::Linux),};let nickname = nickname.unwrap_or_else(|| host.clone());@@ -390,9 +391,7 @@ impl TitleBar {.max_w_32().child(IconWithIndicator::new(- Icon::new(IconName::Server)- .size(IconSize::Small)- .color(icon_color),+ Icon::new(icon).size(IconSize::Small).color(icon_color),Some(Indicator::dot().color(indicator_color)),).indicator_border_color(Some(cx.theme().colors().title_bar_background))