Skip to content

feat(keyboard): F5/F9/F1 function-key shortcuts and tooltip improvements#1489

Open
J2TeamNNL wants to merge 2 commits into
TableProApp:mainfrom
J2TeamNNL:feat/function-key-shortcuts
Open

feat(keyboard): F5/F9/F1 function-key shortcuts and tooltip improvements#1489
J2TeamNNL wants to merge 2 commits into
TableProApp:mainfrom
J2TeamNNL:feat/function-key-shortcuts

Conversation

@J2TeamNNL
Copy link
Copy Markdown
Contributor

Summary

  • F5 refreshes data (secondary binding alongside Cmd+R)
  • F9 runs a query (secondary binding alongside Cmd+Return)
  • F1 opens documentation (primary binding)
  • All three are assignable in Settings > Keyboard
  • Tooltip improvements: Refresh shows ⌘R / F5, Inspector gets a tooltip, Columns button gets .help()

Implementation notes

  • KeyCombo now recognises F1–F12 (keyCode mapping, NSF_FunctionKey Unicode scalars, bare key allowed without modifier)
  • New FunctionKeyShortcutMonitor (NSEvent local monitor) dispatches F-key actions; skips events while ShortcutRecorderNSView is first responder so the recorder still works
  • KeyboardSettings gains an alternates map (Codable, conflict detection, accessors). ShortcutAction gets openDocumentation case (Help category) and supportsFunctionKeyAlternate for Refresh/Execute Query
  • KeyboardSettingsView shows a second recorder for actions with a function-key alternate
  • keyboardShortcut(for:) returns nil for F-key combos so menus don't register them — monitor has sole ownership of function keys

Test plan

  • Open a table → press F5 → data refreshes (same as Cmd+R)
  • Write a query → press F9 → query runs (same as Cmd+Return)
  • Press F1 → docs.tablepro.app opens in browser
  • Cmd+R / Cmd+Return still work unchanged
  • Settings > Keyboard → Refresh and Execute Query have a second recorder (F5/F9 by default); open Documentation row shows F1
  • Changing/clearing a function-key alternate takes effect immediately
  • Conflict detection works between primary and secondary bindings
  • Reset to Defaults restores F5/F9/F1
  • Unit tests pass: xcodebuild ... test -only-testing:TableProTests/KeyboardShortcutModelsTests

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

return KeyboardSettings(shortcuts: cleaned)

P2 Badge Preserve alternate shortcuts during sanitization

When keyboard settings are loaded, AppSettingsStorage.loadKeyboard() immediately calls sanitized(), but this return value rebuilds KeyboardSettings with only shortcuts and drops alternates. As a result, any customized or cleared F5/F9 alternate binding is lost on app restart or sync import and silently falls back to the defaults; carry the existing sanitized alternates into the returned settings.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}

if !combo.hasModifier, !action.allowsBareKey {
if !combo.hasModifier, !action.allowsBareKey, !combo.isFunctionKey {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject undispatched primary function-key shortcuts

This allows recording a bare function key as the primary shortcut for any menu-driven action, but keyboardShortcut(for:) then returns nil for function keys and FunctionKeyShortcutMonitor.matchedAction only dispatches the openDocumentation primary plus refresh/executeQuery alternates. For example, assigning F2 as the primary shortcut for Format Query is accepted and displayed in settings, but pressing F2 never reaches the action; limit primary F-key acceptance to actions the monitor actually handles or dispatch all function-key primaries.

Useful? React with 👍 / 👎.

@J2TeamNNL J2TeamNNL force-pushed the feat/function-key-shortcuts branch 3 times, most recently from 944eb6b to 00d76f6 Compare May 31, 2026 06:18
@J2TeamNNL J2TeamNNL force-pushed the feat/function-key-shortcuts branch from 00d76f6 to 5d616f5 Compare May 31, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant