Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src-tauri/src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub fn create_menu_with_themes<R: tauri::Runtime>(
"toggle_terminal",
"Toggle Terminal",
true,
Some("CmdOrCtrl+J"),
Some("CmdOrCtrl+`"),
)?)
.item(&MenuItem::with_id(
app,
Expand Down
27 changes: 26 additions & 1 deletion src/features/keymaps/utils/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
import type { ParsedKey } from "./parser";
import { parseKeybinding } from "./parser";

/**
* Map of event.code to logical key name for special keys
* This helps handle keys that might report "Dead" or other values for event.key
*/
const CODE_TO_KEY: Record<string, string> = {
Backquote: "`",
Minus: "-",
Equal: "=",
BracketLeft: "[",
BracketRight: "]",
Backslash: "\\",
Semicolon: ";",
Quote: "'",
Comma: ",",
Period: ".",
Slash: "/",
};

/**
* Convert KeyboardEvent to ParsedKey format
*/
Expand All @@ -19,9 +37,16 @@ export function eventToKey(event: KeyboardEvent): ParsedKey {

modifiers.sort();

// Use event.key by default, but fall back to code mapping for special keys
// This handles cases where event.key returns "Dead" or other non-character values
let key = event.key;
if (key === "Dead" || key === "Unidentified") {
key = CODE_TO_KEY[event.code] || event.code;
}

return {
modifiers,
key: event.key,
key,
};
}

Expand Down