# sindresorhus/KeyboardShortcuts

⌨️ Add user-customizable global keyboard shortcuts (hotkeys) to your macOS app in minutes

Repository: https://github.com/sindresorhus/KeyboardShortcuts
Canonical: https://ross.abutalabs.com/products/keyboardshortcuts
Homepage: https://swiftpackageindex.com/sindresorhus/KeyboardShortcuts/documentation/keyboardshortcuts/keyboardshortcuts
Language: Swift
License: MIT
License Family: permissive
Topics: keyboard-shortcuts, hotkey, macos, swift-package, swift-package-manager, carthage, cocoapods, swiftui, swiftui-components
Last push: 2026-06-17T10:24:25+00:00

## Health v2 (maintenance only)
Score: 91/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 88, release rhythm 89, longevity 100
- inputs: {"age_days": 2309, "days_push": 77, "days_rel": 77, "gap_med": 16, "n_releases_24m": 10}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2700, forks 248 (observed 2026-08-28T04:07:11.396769+00:00)

## What it is
A Swift package that lets macOS developers add user-customizable global keyboard shortcuts (hotkeys) to their apps with minimal code. It provides SwiftUI and Cocoa recorder components, persists shortcuts to UserDefaults, and warns about conflicts with system shortcuts.

## Use cases
- add user-customizable global hotkeys to a macOS app
- let users record keyboard shortcuts in a settings screen
- register global key listeners in Swift
- avoid conflicts with system keyboard shortcuts
- add hotkey support to a SwiftUI macOS app
- persist user keyboard shortcut preferences

## When to choose
- you're building a macOS app in Swift and want global hotkeys quickly
- you need a ready-made shortcut recorder UI for SwiftUI or Cocoa
- you want Mac App Store-compatible, sandboxed hotkey support

## When to avoid
- you need cross-platform keyboard shortcut handling
- your app targets iOS or other non-macOS platforms
- you need in-app-only (non-global) key handling

## Facets
- artifact type: library
- maturity: stable
- function: ui-components, developer-tools
- domain: operating-systems, developer-tools, desktop-applications
- platform: -
- tags: keyboard-shortcuts, hotkeys, swiftui, swift-package-manager, cocoa, macos, swift, desktop

## Member repositories
- sindresorhus/KeyboardShortcuts (main) score 91

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:11.396769+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:16:06.093866+00:00, confidence not recorded.
  - readme: https://github.com/sindresorhus/KeyboardShortcuts (fetched 2026-08-28T04:07:11.396769+00:00, sha 2d3f111bb346)
- Data as of 2026-08-30T08:39:29.467469+00:00.
