soffes/HotKey
soffes/HotKey has 1,082 GitHub stars and 87 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-09 10:33 UTC. Last push 2024-12-29.
Simple global shortcuts in macOS
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalHotKey
Simple global shortcuts in macOS. HotKey wraps the Carbon APIs for dealing with global hot keys to make it easy to use in Swift.
Installation
Swift Package Manager
For installation with Swift Package Manager, simply add the following to your Package.swift:
.package(url: "https://github.com/soffes/HotKey", from: "0.2.1")
Carthage
For installation with Carthage, simply add the following to your Cartfile:
github "soffes/HotKey"
CocoaPods
For installation with CocoaPods, simply add the following to your Podfile:
pod 'HotKey'
Usage
Simply initialize a HotKey with a key and modifiers:
// Setup hot key for ⌥⌘R
let hotKey = HotKey(key: .r, modifiers: [.command, .option])
This is a convenice initializer that creates a KeyCombo for you. You can also initialize with a Carbon key code and Carbon modifier flags if you’re feeling old school.
Now you can set the keyDownHandler and get callbacks for when your hot key is pressed:
hotKey.keyDownHandler = {
print("Pressed at \(Date())")
}
You can also implement hotKey.keyUpHandler if you’d like.
You don’t need to think about when handlers are registered and unregistered. This all happens automatically based on the HotKey object’s lifecycle.
Thanks
HotKey was heavily inspired by PTHotKey.
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
561,306 starspublic-apis/public-apis
A collective list of free APIs
497,552 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
446,348 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,246 stars