feat(keyboard): migrate all shortcuts from cmdorctrl to ctrl modifier
Removes support for cmd/cmdorctrl modifiers and standardizes on ctrl+ across all keyboard shortcuts. Existing configs with cmdorctrl still work via backward compatibility layer.
- commit
- 74f641a0e398e4b0065c7f61f0c51f97b0d35626
- author
- bnema · · 2025-10-23 16:43 UTC
- committer
- bnema · · 2025-10-24 17:33 UTC
- parent
- fe885f2
- signature
- GPG Unverified
2B82207D370127A0The key is unknown
3 files · +10 -17
M gui/src/lib/keyboard/KeyboardService.ts +5 -10
| @@ -343,13 +343,8 @@ export class KeyboardService { | |||
| 343 | 343 | const parts: string[] = []; | |
| 344 | 344 | ||
| 345 | 345 | // Add modifiers using MODIFIER_KEYS mapping | |
| 346 | - | if (event.ctrlKey && event.metaKey) { | |
| 347 | - | // Both ctrl and meta pressed - use cmdorctrl | |
| 348 | - | parts.push("cmdorctrl"); | |
| 349 | - | } else if (event.ctrlKey) { | |
| 346 | + | if (event.ctrlKey) { | |
| 350 | 347 | parts.push("ctrl"); | |
| 351 | - | } else if (event.metaKey) { | |
| 352 | - | parts.push("cmd"); | |
| 353 | 348 | } | |
| 354 | 349 | ||
| 355 | 350 | if (event.altKey) parts.push("alt"); | |
| @@ -407,20 +402,20 @@ export const keyboardService = new KeyboardService({ | |||
| 407 | 402 | globalShortcuts: [ | |
| 408 | 403 | // Navigation shortcuts (migrated from controls module) | |
| 409 | 404 | { | |
| 410 | - | key: "cmdorctrl+arrowleft", | |
| 405 | + | key: "ctrl+arrowleft", | |
| 411 | 406 | handler: () => { | |
| 412 | 407 | if (window.history.length > 1) { | |
| 413 | 408 | window.history.back(); | |
| 414 | 409 | } | |
| 415 | 410 | }, | |
| 416 | - | description: "Navigate back (Ctrl/Cmd+Left Arrow)", | |
| 411 | + | description: "Navigate back (Ctrl+Left Arrow)", | |
| 417 | 412 | }, | |
| 418 | 413 | { | |
| 419 | - | key: "cmdorctrl+arrowright", | |
| 414 | + | key: "ctrl+arrowright", | |
| 420 | 415 | handler: () => { | |
| 421 | 416 | window.history.forward(); | |
| 422 | 417 | }, | |
| 423 | - | description: "Navigate forward (Ctrl/Cmd+Right Arrow)", | |
| 418 | + | description: "Navigate forward (Ctrl+Right Arrow)", | |
| 424 | 419 | }, | |
| 425 | 420 | // Note: Global UI shortcuts (Ctrl+L, Ctrl+F, Ctrl+Shift+C) are now handled | |
| 426 | 421 | // directly by the native Go shortcut handlers to ensure proper active pane detection. | |
| @@ -343,13 +343,8 @@ export class KeyboardService { | |||||
| 343 | const parts: string[] = []; | 343 | const parts: string[] = []; | ||
| 344 | 344 | ||||
| 345 | // Add modifiers using MODIFIER_KEYS mapping | 345 | // Add modifiers using MODIFIER_KEYS mapping | ||
| 346 | - | if (event.ctrlKey && event.metaKey) { | 346 | + | if (event.ctrlKey) { |
| 347 | - | // Both ctrl and meta pressed - use cmdorctrl | |||
| 348 | - | parts.push("cmdorctrl"); | |||
| 349 | - | } else if (event.ctrlKey) { | |||
| 350 | parts.push("ctrl"); | 347 | parts.push("ctrl"); | ||
| 351 | - | } else if (event.metaKey) { | |||
| 352 | - | parts.push("cmd"); | |||
| 353 | } | 348 | } | ||
| 354 | 349 | ||||
| 355 | if (event.altKey) parts.push("alt"); | 350 | if (event.altKey) parts.push("alt"); | ||
| @@ -407,20 +402,20 @@ export const keyboardService = new KeyboardService({ | |||||
| 407 | globalShortcuts: [ | 402 | globalShortcuts: [ | ||
| 408 | // Navigation shortcuts (migrated from controls module) | 403 | // Navigation shortcuts (migrated from controls module) | ||
| 409 | { | 404 | { | ||
| 410 | - | key: "cmdorctrl+arrowleft", | 405 | + | key: "ctrl+arrowleft", |
| 411 | handler: () => { | 406 | handler: () => { | ||
| 412 | if (window.history.length > 1) { | 407 | if (window.history.length > 1) { | ||
| 413 | window.history.back(); | 408 | window.history.back(); | ||
| 414 | } | 409 | } | ||
| 415 | }, | 410 | }, | ||
| 416 | - | description: "Navigate back (Ctrl/Cmd+Left Arrow)", | 411 | + | description: "Navigate back (Ctrl+Left Arrow)", |
| 417 | }, | 412 | }, | ||
| 418 | { | 413 | { | ||
| 419 | - | key: "cmdorctrl+arrowright", | 414 | + | key: "ctrl+arrowright", |
| 420 | handler: () => { | 415 | handler: () => { | ||
| 421 | window.history.forward(); | 416 | window.history.forward(); | ||
| 422 | }, | 417 | }, | ||
| 423 | - | description: "Navigate forward (Ctrl/Cmd+Right Arrow)", | 418 | + | description: "Navigate forward (Ctrl+Right Arrow)", |
| 424 | }, | 419 | }, | ||
| 425 | // Note: Global UI shortcuts (Ctrl+L, Ctrl+F, Ctrl+Shift+C) are now handled | 420 | // Note: Global UI shortcuts (Ctrl+L, Ctrl+F, Ctrl+Shift+C) are now handled | ||
| 426 | // directly by the native Go shortcut handlers to ensure proper active pane detection. | 421 | // directly by the native Go shortcut handlers to ensure proper active pane detection. | ||
M gui/src/lib/keyboard/types.ts +3 -5
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | */ | |
| 7 | 7 | ||
| 8 | 8 | export interface ShortcutConfig { | |
| 9 | - | /** The keyboard shortcut key combination (e.g., 'cmdorctrl+l', 'escape', 'enter') */ | |
| 9 | + | /** The keyboard shortcut key combination (e.g., 'ctrl+l', 'escape', 'enter') */ | |
| 10 | 10 | key: string; | |
| 11 | 11 | ||
| 12 | 12 | /** Function to execute when the shortcut is triggered */ | |
| @@ -78,8 +78,6 @@ export interface KeyboardEvent { | |||
| 78 | 78 | */ | |
| 79 | 79 | export const MODIFIER_KEYS = { | |
| 80 | 80 | ctrl: "ctrlKey", | |
| 81 | - | cmd: "metaKey", | |
| 82 | - | cmdorctrl: navigator.platform.includes("Mac") ? "metaKey" : "ctrlKey", | |
| 83 | 81 | alt: "altKey", | |
| 84 | 82 | shift: "shiftKey", | |
| 85 | 83 | } as const; | |
| @@ -88,8 +86,8 @@ export const MODIFIER_KEYS = { | |||
| 88 | 86 | * Common shortcut patterns used throughout the application | |
| 89 | 87 | */ | |
| 90 | 88 | export const COMMON_SHORTCUTS = { | |
| 91 | - | OMNIBOX_OPEN: "cmdorctrl+l", | |
| 92 | - | FIND_OPEN: "cmdorctrl+f", | |
| 89 | + | OMNIBOX_OPEN: "ctrl+l", | |
| 90 | + | FIND_OPEN: "ctrl+f", | |
| 93 | 91 | ESCAPE: "escape", | |
| 94 | 92 | ENTER: "enter", | |
| 95 | 93 | ARROW_UP: "arrowup", | |
| @@ -6,7 +6,7 @@ | |||||
| 6 | */ | 6 | */ | ||
| 7 | 7 | ||||
| 8 | export interface ShortcutConfig { | 8 | export interface ShortcutConfig { | ||
| 9 | - | /** The keyboard shortcut key combination (e.g., 'cmdorctrl+l', 'escape', 'enter') */ | 9 | + | /** The keyboard shortcut key combination (e.g., 'ctrl+l', 'escape', 'enter') */ |
| 10 | key: string; | 10 | key: string; | ||
| 11 | 11 | ||||
| 12 | /** Function to execute when the shortcut is triggered */ | 12 | /** Function to execute when the shortcut is triggered */ | ||
| @@ -78,8 +78,6 @@ export interface KeyboardEvent { | |||||
| 78 | */ | 78 | */ | ||
| 79 | export const MODIFIER_KEYS = { | 79 | export const MODIFIER_KEYS = { | ||
| 80 | ctrl: "ctrlKey", | 80 | ctrl: "ctrlKey", | ||
| 81 | - | cmd: "metaKey", | |||
| 82 | - | cmdorctrl: navigator.platform.includes("Mac") ? "metaKey" : "ctrlKey", | |||
| 83 | alt: "altKey", | 81 | alt: "altKey", | ||
| 84 | shift: "shiftKey", | 82 | shift: "shiftKey", | ||
| 85 | } as const; | 83 | } as const; | ||
| @@ -88,8 +86,8 @@ export const MODIFIER_KEYS = { | |||||
| 88 | * Common shortcut patterns used throughout the application | 86 | * Common shortcut patterns used throughout the application | ||
| 89 | */ | 87 | */ | ||
| 90 | export const COMMON_SHORTCUTS = { | 88 | export const COMMON_SHORTCUTS = { | ||
| 91 | - | OMNIBOX_OPEN: "cmdorctrl+l", | 89 | + | OMNIBOX_OPEN: "ctrl+l", |
| 92 | - | FIND_OPEN: "cmdorctrl+f", | 90 | + | FIND_OPEN: "ctrl+f", |
| 93 | ESCAPE: "escape", | 91 | ESCAPE: "escape", | ||
| 94 | ENTER: "enter", | 92 | ENTER: "enter", | ||
| 95 | ARROW_UP: "arrowup", | 93 | ARROW_UP: "arrowup", | ||
M internal/app/browser/shortcuts.go +2 -2
| @@ -67,7 +67,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||
| 67 | 67 | // by WindowShortcutHandler at the window level to prevent duplicates | |
| 68 | 68 | ||
| 69 | 69 | // Page refresh shortcuts | |
| 70 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+r", 0, func() { | |
| 70 | + | _ = s.webView.RegisterKeyboardShortcut("ctrl+r", 0, func() { | |
| 71 | 71 | if !s.isActivePane() { | |
| 72 | 72 | return | |
| 73 | 73 | } | |
| @@ -75,7 +75,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||
| 75 | 75 | _ = s.webView.Reload() | |
| 76 | 76 | }) | |
| 77 | 77 | ||
| 78 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+shift+r", 0, func() { | |
| 78 | + | _ = s.webView.RegisterKeyboardShortcut("ctrl+shift+r", 0, func() { | |
| 79 | 79 | if !s.isActivePane() { | |
| 80 | 80 | return | |
| 81 | 81 | } | |
| @@ -67,7 +67,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||||
| 67 | // by WindowShortcutHandler at the window level to prevent duplicates | 67 | // by WindowShortcutHandler at the window level to prevent duplicates | ||
| 68 | 68 | ||||
| 69 | // Page refresh shortcuts | 69 | // Page refresh shortcuts | ||
| 70 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+r", 0, func() { | 70 | + | _ = s.webView.RegisterKeyboardShortcut("ctrl+r", 0, func() { |
| 71 | if !s.isActivePane() { | 71 | if !s.isActivePane() { | ||
| 72 | return | 72 | return | ||
| 73 | } | 73 | } | ||
| @@ -75,7 +75,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||||
| 75 | _ = s.webView.Reload() | 75 | _ = s.webView.Reload() | ||
| 76 | }) | 76 | }) | ||
| 77 | 77 | ||||
| 78 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+shift+r", 0, func() { | 78 | + | _ = s.webView.RegisterKeyboardShortcut("ctrl+shift+r", 0, func() { |
| 79 | if !s.isActivePane() { | 79 | if !s.isActivePane() { | ||
| 80 | return | 80 | return | ||
| 81 | } | 81 | } | ||