Skip to content
CAI
Software that uses CAICheck a score

sindresorhus/KeyboardShortcuts

63.9

Adequate · 30 September 2026

4.4k

lines of production code

Swift

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a macOS framework for managing keyboard shortcuts, providing a SwiftUI-based recorder UI and APIs for handling shortcut conflicts and key events. It supports internationalization across numerous languages and includes a comprehensive test suite to ensure reliability. The project has been modernized to use Swift Package Manager exclusively, targeting Swift 6 and macOS 10.15+.

How it got here

2020–2021 — SwiftUI migration and localization

13 changes.

The project migrated its build infrastructure to Swift Package Manager and upgraded to Swift 6, while completely rewriting the example app and framework UI to use SwiftUI. This period also introduced comprehensive conflict-handling policies and added full internationalization support for the recorder interface in English, Chinese, German, and Russian.

2022–2026 — Keyboard shortcuts localization expansion

11 changes.

This period focused on expanding internationalization support for the KeyboardShortcuts library by adding localization files for multiple languages, including Spanish, Hungarian, Czech, Arabic, Dutch, French, Japanese, Korean, Brazilian Portuguese, Slovak, Italian, and Polish. The work involved translating core UI strings related to recording, pressing, and clearing shortcuts, as well as system conflict warnings and modifier key instructions.

Features

Add English localization for keyboard shortcut UI strings

The library now includes an English localization file (Localizable.strings) providing user-facing text for the keyboard shortcut recording interface. This adds translations for action labels such as "Record Shortcut" and "Clear Shortcut", status messages explaining why a shortcut might be unavailable (e.g., conflicts with menu items or system shortcuts), and specific validation text for macOS 15+ sandboxed apps requiring the Option modifier to be combined with Command or Control.

Sources/KeyboardShortcuts/Localization/en.lproj · high confidence

Add Italian localization for keyboard shortcuts

Users can now see keyboard shortcut-related messages in Italian. This change adds a new Localizable.strings file for the Italian locale, providing translations for actions like recording or clearing shortcuts, system conflict warnings, and modifier key restrictions.

Sources/KeyboardShortcuts/Localization/it.lproj · high confidence

Add Russian localization for keyboard shortcut strings

This change introduces a new Russian localization file (ru.lproj/Localizable.strings) for the KeyboardShortcuts component. It provides translations for user-facing strings related to recording shortcuts, handling conflicts with menu items or system shortcuts, clearing shortcuts, and specific key labels like 'Space'. This enables the application to display keyboard shortcut interactions in Russian.

Sources/KeyboardShortcuts/Localization/ru.lproj · high confidence

Add Simplified Chinese (zh-Hans) localization for keyboard shortcuts

Users with Simplified Chinese locale settings will now see localized strings for the keyboard shortcut recorder interface, including labels for recording, clearing, and forcing shortcuts, as well as system constraint messages (e.g., Option key requirements) and the Space key label.

Sources/KeyboardShortcuts/Localization/zh-Hans.lproj · high confidence

Add Slovak localization for keyboard shortcuts

Users with Slovak language settings will now see localized strings for keyboard shortcut interactions, including prompts to record or press shortcuts, warnings about conflicts with menu items or system-wide shortcuts, instructions to change system shortcuts, and specific messages regarding modifier key restrictions (Option requiring Command or Control) and the Space key.

Sources/KeyboardShortcuts/Localization/sk.lproj · high confidence

Add Spanish localization for keyboard shortcuts

This change introduces the initial Spanish (es) localization file for the KeyboardShortcuts library, providing user-facing strings for recording, pressing, clearing, and validating keyboard shortcuts, as well as system conflict warnings and specific key labels like 'Space'.

Sources/KeyboardShortcuts/Localization/es.lproj · high confidence

Add Traditional Chinese (zh-TW) localization for keyboard shortcuts

Users with Traditional Chinese language settings will now see the keyboard shortcut recorder interface translated into their language. This change adds the Localizable.strings file for the zh-TW.lproj bundle, providing translations for key UI elements such as 'Set Shortcut', 'Press Shortcut', error messages regarding conflicts with menu items or system shortcuts, and specific key labels like 'Space'.

Sources/KeyboardShortcuts/Localization/zh-TW.lproj · high confidence

Added Arabic localization for keyboard shortcuts

Users can now see keyboard shortcut labels and messages in Arabic. This change adds the Arabic localization file (ar.lproj/Localizable.strings) containing translations for key actions such as recording, pressing, and clearing shortcuts, as well as system conflict warnings and button labels like 'OK' and 'Force use'.

Sources/KeyboardShortcuts/Localization/ar.lproj · high confidence

Added Brazilian Portuguese (pt-BR) localization for keyboard shortcuts

Users can now see keyboard shortcut labels and messages in Brazilian Portuguese. This change adds a new Localizable.strings file containing translations for core UI elements such as 'Record Shortcut', 'Press Shortcut', 'Clear Shortcut', and specific system messages regarding shortcut conflicts, disallowed modifiers (Option without Command/Control), and the Space key.

Sources/KeyboardShortcuts/Localization/pt-BR.lproj · high confidence

Added Czech localization for keyboard shortcuts

Users can now see keyboard shortcut labels and messages in Czech. This change adds a new Localizable.strings file for the cs.lproj locale, providing translations for actions like adding, clearing, and overriding shortcuts, as well as system messages regarding conflicts and modifier key restrictions.

Sources/KeyboardShortcuts/Localization/cs.lproj · high confidence

Added Dutch and French localization for keyboard shortcuts

The library now includes localized user-facing strings for Dutch (nl) and French (fr), covering messages for recording shortcuts, warnings about system or menu-item conflicts, and modifier key restrictions. This enables users of these languages to see interface text in their native language rather than the default English.

Sources/KeyboardShortcuts/Localization/nl.lproj · high confidence

Added German localization for keyboard shortcut UI strings

Users can now see keyboard shortcut prompts, error messages, and button labels in German. This change adds the de.lproj Localizable.strings file containing translations for actions like recording or clearing shortcuts, warnings about system-wide conflicts or disallowed key combinations (specifically requiring Option with Command or Control), and standard UI buttons.

Sources/KeyboardShortcuts/Localization/de.lproj · high confidence

Added Hungarian localization for keyboard shortcuts

Users can now see keyboard shortcut labels and messages in Hungarian. This change adds a new Localizable.strings file for the hu.lproj localization bundle, providing translations for actions like recording, pressing, and clearing shortcuts, as well as system warnings about reserved keys and modifier requirements.

Sources/KeyboardShortcuts/Localization/hu.lproj · high confidence

Added Japanese localization for keyboard shortcut strings

Users can now see keyboard shortcut prompts and messages in Japanese. This change adds a new Localizable.strings file for the ja.lproj localization bundle, providing translations for key UI elements such as recording shortcuts, detecting conflicts with system or menu-item shortcuts, handling disallowed Option key combinations, and clearing or forcing shortcuts.

Sources/KeyboardShortcuts/Localization/ja.lproj · high confidence

Added Korean localization for keyboard shortcut strings

Users can now see keyboard shortcut labels and messages in Korean. This change adds a new Localizable.strings file for the ko.lproj locale, providing translations for actions such as recording, pressing, and clearing shortcuts, as well as system messages regarding conflicts and disallowed modifier keys.

Sources/KeyboardShortcuts/Localization/ko.lproj · high confidence

Added Polish language localization for keyboard shortcuts

Users can now see keyboard shortcut labels and system messages in Polish. This change adds a new Localizable.strings file for the pl.lproj localization bundle, providing translations for core UI elements such as 'Record shortcut', 'Press shortcut', conflict warnings, and modifier key instructions.

Sources/KeyboardShortcuts/Localization/pl.lproj · high confidence

Removals

Removed Xcode project and scheme files

The Xcode project configuration files, including the project file (project.pbxproj), the framework info plist, and the example app scheme, have been deleted from the repository. This change removes the legacy Xcode workspace structure, indicating a shift away from Xcode-based building for this location.

KeyboardShortcuts.xcodeproj · high confidence

Behavioural changes

KeyboardShortcutsExample rewritten for SwiftUI and modern APIs

The example application has been completely rewritten as a SwiftUI app, replacing the previous implementation. It now demonstrates modern library features including the new \.events()\ listener method, a \.resetAll()\ API for clearing shortcuts, and a dedicated API for handling repeating key-down events. The UI showcases these capabilities through sections for fixed, binding, and dynamic shortcuts, and includes a custom menu item validation utility to handle conflicts.

Example/KeyboardShortcutsExample · high confidence

Migrate KeyboardShortcutsExample to SwiftUI

The KeyboardShortcutsExample app has been refactored from a traditional AppKit-based architecture to SwiftUI. The legacy AppDelegate, Main.storyboard, and Info.plist entries for the main storyboard have been removed, and the UI is now driven by a SwiftUI ContentView that utilizes KeyboardShortcuts.Recorder and modifier-based key event handling.

KeyboardShortcutsExample · high confidence

Migration to Swift Package Manager scheme structure

The Xcode project scheme has been migrated from the legacy .xcodeproj location to the standard .swiftpm directory structure. This update adjusts build and test references to align with Swift Package Manager conventions, ensuring correct identification of the KeyboardShortcuts framework and its associated tests within the package environment.

.swiftpm · high confidence

New conflict-handling policy and SwiftUI Recorder API

The framework now lets you control how keyboard shortcut conflicts are handled via a new \ConflictPolicy\ enum (\.block\, \.warn\, \.allow\) for menu items, system shortcuts, and disallowed combinations, applied through a new \.keyboardShortcutsConflictPolicy()\ SwiftUI view modifier. The \Recorder\ view has been refactored to support a \Label\-based initializer and optional bindings, while the underlying \NSMenuItem\ shortcut binding now preserves and restores the original key equivalent when the shortcut is cleared.

Sources/KeyboardShortcuts · high confidence

Updated KeyboardShortcutsExample project to Xcode 14 and Swift 5.5

The KeyboardShortcutsExample project has been upgraded to target Xcode 14.0, as indicated by the compatibility version and build settings in the project file. This update aligns the example application with Swift 5.5, ensuring it builds correctly with modern tooling and resolves deprecations associated with older Xcode versions.

Example/KeyboardShortcutsExample.xcodeproj · high confidence

Test coverage

Added comprehensive test suite for KeyboardShortcuts

Added a new test suite covering core keyboard shortcut functionality, including setting, resetting, and persisting shortcuts, as well as validation of shortcut names. The tests also verify the behavior of the RecorderCocoa UI component, ensuring it handles default sizes, direct shortcut storage, validation callbacks, and state management when switching between multiple recorders.

Tests · high confidence

Dependencies

Drops CocoaPods support and upgrades to Swift 6 with macOS 10.15 minimum

The package now requires macOS 10.15 or later and Swift 6.2, enabling modern concurrency features like MainActor isolation and upcoming language features. CocoaPods support has been removed, leaving Swift Package Manager as the sole distribution method, and a new test target has been added to the package structure.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 64 → 64 (+0.3)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 97 → 97 (-0.2)
  • Architecture 100 → 100 (+0.0)
  • Maturity 53 → 53 (+0.0)
  • Readiness 48 → 51 (+2.6)
  • Security 97 → 97 (+0.0)

Resolved (2)

  • Documentation: no architecture or design documentation (README.md)
  • Off-boarding risk: anonymized user #1

New (10)

  • Coverage not measured — Swift suite
  • Duplicated block (16 lines × 2) (Sources/KeyboardShortcuts/Shortcut.swift)
  • Duplicated block (38 lines × 2) (Sources/KeyboardShortcuts/Shortcut.swift)
  • MethodTooLong: SpecialKey.appKitMenuItemKeyEquivalent (Sources/KeyboardShortcuts/Shortcut.swift)
  • MethodTooLong: SpecialKey.presentableDescription (Sources/KeyboardShortcuts/Shortcut.swift)
  • MethodTooLong: SpecialKey.swiftUIKeyEquivalent (Sources/KeyboardShortcuts/Shortcut.swift)
  • Off-boarding risk: anonymized user #1
  • Redundant overloads for single vs. collection input. Same issue as disable and enable.
  • Redundant overloads for single vs. collection input. Same issue as disable.
  • Redundant overloads for single vs. collection input. Swift APIs typically prefer a single collection-based overload (e.g., disable([Name])) which handles both single and multiple items via array literals or single-element arrays, or use a variadic parameter. Having both explicit overloads creates unnecessary API surface and potential ambiguity.

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

sindresorhus/KeyboardShortcuts was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 772133d9dbe800fdac0473226822994c5c162c58 — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.