mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Bind cmd-? to assistant::toggle_focus
Bypass system help menu shortcut at the app delegate level to achieve this. Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
parent
7efcd60608
commit
8f8a99d788
@ -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"
|
||||
}
|
||||
|
@ -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 || {
|
||||
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user