Add help menu items to visit zed.dev and the zed twitter page
This commit is contained in:
parent
df4f3051bc
commit
1c932ae4ce
2 changed files with 29 additions and 4 deletions
|
@ -247,10 +247,25 @@ pub fn menus() -> Vec<Menu<'static>> {
|
||||||
},
|
},
|
||||||
Menu {
|
Menu {
|
||||||
name: "Help",
|
name: "Help",
|
||||||
items: vec![MenuItem::Action {
|
items: vec![
|
||||||
name: "Command Palette",
|
MenuItem::Action {
|
||||||
action: Box::new(command_palette::Toggle),
|
name: "Command Palette",
|
||||||
}],
|
action: Box::new(command_palette::Toggle),
|
||||||
|
},
|
||||||
|
MenuItem::Separator,
|
||||||
|
MenuItem::Action {
|
||||||
|
name: "Zed.dev",
|
||||||
|
action: Box::new(crate::OpenBrowser {
|
||||||
|
url: "https://zed.dev".into(),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
MenuItem::Action {
|
||||||
|
name: "Zed Twitter",
|
||||||
|
action: Box::new(crate::OpenBrowser {
|
||||||
|
url: "https://twitter.com/zeddotdev".into(),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ use editor::Editor;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions,
|
||||||
geometry::vector::vec2f,
|
geometry::vector::vec2f,
|
||||||
|
impl_actions,
|
||||||
platform::{WindowBounds, WindowOptions},
|
platform::{WindowBounds, WindowOptions},
|
||||||
AsyncAppContext, ViewContext,
|
AsyncAppContext, ViewContext,
|
||||||
};
|
};
|
||||||
|
@ -23,6 +24,7 @@ use project::Project;
|
||||||
pub use project::{self, fs};
|
pub use project::{self, fs};
|
||||||
use project_panel::ProjectPanel;
|
use project_panel::ProjectPanel;
|
||||||
use search::{BufferSearchBar, ProjectSearchBar};
|
use search::{BufferSearchBar, ProjectSearchBar};
|
||||||
|
use serde::Deserialize;
|
||||||
use serde_json::to_string_pretty;
|
use serde_json::to_string_pretty;
|
||||||
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
|
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -33,6 +35,13 @@ use util::ResultExt;
|
||||||
pub use workspace;
|
pub use workspace;
|
||||||
use workspace::{AppState, Workspace};
|
use workspace::{AppState, Workspace};
|
||||||
|
|
||||||
|
#[derive(Deserialize, Clone)]
|
||||||
|
struct OpenBrowser {
|
||||||
|
url: Arc<str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_actions!(zed, [OpenBrowser]);
|
||||||
|
|
||||||
actions!(
|
actions!(
|
||||||
zed,
|
zed,
|
||||||
[
|
[
|
||||||
|
@ -61,6 +70,7 @@ lazy_static! {
|
||||||
pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
cx.add_action(about);
|
cx.add_action(about);
|
||||||
cx.add_global_action(quit);
|
cx.add_global_action(quit);
|
||||||
|
cx.add_global_action(move |action: &OpenBrowser, cx| cx.platform().open_url(&action.url));
|
||||||
cx.add_global_action(move |_: &IncreaseBufferFontSize, cx| {
|
cx.add_global_action(move |_: &IncreaseBufferFontSize, cx| {
|
||||||
cx.update_global::<Settings, _, _>(|settings, cx| {
|
cx.update_global::<Settings, _, _>(|settings, cx| {
|
||||||
settings.buffer_font_size = (settings.buffer_font_size + 1.0).max(MIN_FONT_SIZE);
|
settings.buffer_font_size = (settings.buffer_font_size + 1.0).max(MIN_FONT_SIZE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue