Skip to content

feat(screenshot): add numbered annotation shortcuts - #528

Open
xcv58 wants to merge 1 commit into
mactools-app:mainfrom
xcv58:codex/screenshot-toolbar-shortcuts
Open

xcv58 wants to merge 1 commit into
mactools-app:mainfrom
xcv58:codex/screenshot-toolbar-shortcuts

Conversation

@xcv58

@xcv58 xcv58 commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Problem and result

Screenshot annotation tools currently rely on letter shortcuts, and Spotlight has no tool-selection shortcut. This adds Command-1 through Command-9 in toolbar order while retaining the existing letters.

Related to the screenshot shortcut request in #522. This PR contains only screenshot toolbar work; the compact clipboard view remains in separate PR #526.

Changes

  • Map ⌘1–⌘9 to Rectangle, Ellipse, Line, Arrow, Pen, Text, Number, Mosaic, and Spotlight using physical number-row keys.
  • Preserve the existing active-tool toggle behavior and ignore key repeats. Apply numbered shortcuts only after region selection in screenshot annotation, with drag, OCR, scrolling, and recording boundaries respected.
  • Commit live annotation text before switching tools, preserve native text-editing commands, and defer switching during marked-text composition.
  • Add hints to existing localized tooltips/accessibility labels using the shared shortcut formatter. Keep toolbar layout, localized discovery metadata, global capture bindings, permissions, and PluginKit API unchanged.

Verification

  • make test TEST_FILTER=ScreenshotAnnotationEditingTests: 8 passed, 0 failures. Includes numbered mappings, repeat/modifier boundaries, existing aliases, live-text export, native Select All, and marked-text preservation.
  • python3 -m unittest scripts.tests.test_plugin_minimum_host_compatibility: 22 passed.
  • Changelog, complete localization, generated plugin data, preference-backup inventory, and whitespace checks passed.
  • Fresh signed Debug build passed, with matching plugin packages installed and the Screenshot plugin loaded in MacTools Dev. The change was tried locally by the requester.
  • Two reviewers with fresh contexts found no actionable issues. Native probes checked all mappings, mode/drag exclusions, exact live Unicode text commitment, selection/composition preservation, focus restoration, native event delivery, and hidden-overlay routing. One probe freshly compiled the frozen Overlay source and its supporting inputs; the other used source-consistent test products. Reviewed source hashes still match this PR.

Local validation used Xcode beta on Apple silicon/macOS 27.3. Physical IME interaction, macOS 14, and Intel remain manual checks; marked-text coverage uses native NSTextView.setMarkedText. The full repository XCTest suite was not rerun for this plugin-only change.

UI evidence

Entry point: Screenshot → select a region → press ⌘1–⌘9, or hover an annotation tool to see its shortcut. The final captures show the new Spotlight hint; the annotation toolbar keeps its existing layout.

Before images are the existing screenshots on main. New captures use only synthetic content and an isolated in-memory environment; the fixture captures its own window without reading the desktop or clipboard history.

Appearance Before (main) After
Light Existing screenshot toolbar, light Numbered toolbar shortcuts, light
Dark Existing screenshot toolbar, dark Numbered toolbar shortcuts, dark

The native walkthrough posts ⌘1–⌘9 into the fixture's AppKit event loop and captures each selected tool, followed by text entry and ⌘4 committing that text while selecting Arrow. The animation assembles those native window captures; it does not record physical keyboard or global shortcut delivery.

Native numbered-shortcut walkthrough

Checklist

  • Core behavior and relevant risks are verified using existing tests, focused additions, or manual checks; results or limitations are recorded.
  • UI evidence is attached where applicable; shared components, themes, localization, and accessibility are respected.
  • User-facing documentation and changelog fragments are updated when required.
  • Plugin metadata, runtime contracts, action policies, and minimum-host compatibility agree.
  • Licensing and third-party notices are complete; no credentials, local configuration, or unrelated generated files are included.

@xcv58
xcv58 marked this pull request as ready for review November 6, 2026 17:52

This branch has not been deployed

No deployments
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