Skip to content

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

Open
J2TeamNNL wants to merge 9 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 9 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

J2TeamNNL added 9 commits May 25, 2026 18:27
F5 refreshes data (alongside Cmd+R), F9 runs a query (alongside
Cmd+Return), and F1 opens documentation. F5 and F9 act as secondary
bindings so existing shortcuts are preserved.

KeyCombo now recognises F1–F12 via specialKeyName and maps them to
the correct NSF_FunctionKey Unicode scalars. A bare function key is
allowed without a modifier in both the recorder and sanitization.

FunctionKeyShortcutMonitor installs a local NSEvent monitor that
dispatches the three function-key actions. It skips events while
a ShortcutRecorderNSView holds first-responder so recording still
works normally.

KeyboardSettings gains a secondary alternates map with its own
accessors, conflict detection, and Codable round-trip. ShortcutAction
gets a new openDocumentation case (Help category) and
supportsFunctionKeyAlternate for Refresh/Execute Query.

KeyboardSettingsView shows a second recorder field for actions that
support a function-key alternate, and allows function keys without
a modifier in both primary and secondary recorders.

Tooltips updated: Refresh shows Cmd+R / F5, Inspector toolbar item
gains a toolTip, and Columns button in the status bar gets .help().

Docs and CHANGELOG updated; 11 new unit tests cover function-key
round-trips, alternates, conflict detection, and sanitization.
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 👍 / 👎.

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