Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Bind cmd-? to assistant::toggle_focus

Nathan Sobo8f8a99d7886d
diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json
index d08df1f391f..6fc06198fe8 100644
--- a/assets/keymaps/default.json
+++ b/assets/keymaps/default.json
@@ -408,6 +408,7 @@
"cmd-shift-p": "command_palette::Toggle",
"cmd-shift-m": "diagnostics::Deploy",
"cmd-shift-e": "project_panel::ToggleFocus",
+ "cmd-?": "assistant::ToggleFocus",
"cmd-alt-s": "workspace::SaveAll",
"cmd-k m": "language_selector::Toggle"
}
diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs
index 41684f32267..20043a90936 100644
--- a/crates/gpui/src/app.rs
+++ b/crates/gpui/src/app.rs
@@ -152,6 +152,29 @@ impl App {
asset_source,
))));
+ foreground_platform.on_event(Box::new({
+ let cx = app.0.clone();
+ move |event| {
+ if let Event::KeyDown(KeyDownEvent { keystroke, .. }) = &event {
+ // Allow system menu "cmd-?" shortcut to be overridden
+ if keystroke.cmd
+ && !keystroke.shift
+ && !keystroke.alt
+ && !keystroke.function
+ && keystroke.key == "?"
+ {
+ if cx
+ .borrow_mut()
+ .update_active_window(|cx| cx.dispatch_keystroke(keystroke))
+ .unwrap_or(false)
+ {
+ return true;
+ }
+ }
+ }
+ false
+ }
+ }));
foreground_platform.on_quit(Box::new({
let cx = app.0.clone();
move || {
diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs
index ea415cc6a66..e1d80fe25ce 100644
--- a/crates/gpui/src/platform/mac/platform.rs
+++ b/crates/gpui/src/platform/mac/platform.rs
@@ -939,7 +939,6 @@ extern "C" fn send_event(this: &mut Object, _sel: Sel, native_event: id) {
}
}
}
-
msg_send![super(this, class!(NSApplication)), sendEvent: native_event]
}
}
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 5d94622d475..58229d39516 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -72,8 +72,6 @@ fn main() {
let installation_id = app.background().block(installation_id()).ok();
init_panic_hook(&app, installation_id.clone());
- app.background();
-
load_embedded_fonts(&app);
let fs = Arc::new(RealFs);