Make linux prompts a bit better (#13067)

Also prompt with a sensible error on install:cli

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-06-14 16:40:54 -06:00 committed by GitHub
parent 2f6cb49d84
commit fab4b01655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 138 additions and 0 deletions

View file

@ -1,5 +1,7 @@
mod app_menus;
pub mod inline_completion_registry;
#[cfg(target_os = "linux")]
pub(crate) mod linux_prompts;
#[cfg(not(target_os = "linux"))]
pub(crate) mod only_instance;
mod open_listener;
@ -262,9 +264,20 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
.register_action(move |_, _: &ResetBufferFontSize, cx| theme::reset_font_size(cx))
.register_action(|_, _: &install_cli::Install, cx| {
cx.spawn(|workspace, mut cx| async move {
if cfg!(target_os = "linux") {
let prompt = cx.prompt(
PromptLevel::Warning,
"Could not install the CLI",
Some("If you installed Zed from our official release add ~/.local/bin to your PATH.\n\nIf you installed Zed from a different source you may need to create an alias/symlink manually."),
&["Ok"],
);
cx.background_executor().spawn(prompt).detach();
return Ok(());
}
let path = install_cli::install_cli(cx.deref())
.await
.context("error creating CLI symlink")?;
workspace.update(&mut cx, |workspace, cx| {
struct InstalledZedCli;