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
4 changed files with 24 additions and 3 deletions
|
@ -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 || {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue