Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clipy/keyholder
Record shortcuts in macOS, like Alfred.app.
https://github.com/clipy/keyholder
alfred clipy macos record-shortcuts sandbox swift
Last synced: 3 days ago
JSON representation
Record shortcuts in macOS, like Alfred.app.
- Host: GitHub
- URL: https://github.com/clipy/keyholder
- Owner: Clipy
- License: mit
- Created: 2016-06-16T14:58:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-06T00:41:43.000Z (3 months ago)
- Last Synced: 2025-02-15T13:36:59.147Z (3 days ago)
- Topics: alfred, clipy, macos, record-shortcuts, sandbox, swift
- Language: Swift
- Homepage: https://clipy-app.com
- Size: 187 KB
- Stars: 400
- Watchers: 8
- Forks: 33
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# KeyHolder

[](https://github.com/Clipy/KeyHolder/releases/latest)
[](https://github.com/Clipy/KeyHolder/blob/master/LICENSE)
[](https://github.com/Carthage/Carthage)
[](http://cocoadocs.org/docsets/KeyHolder)
[](http://cocoadocs.org/docsets/KeyHolder)
[](https://swift.org/package-manager)Record shortcuts in macOS, like Alfred App.
![]()
## Usage
### CocoaPods
```
pod 'KeyHolder'
```### Carthage
```
github "Clipy/KeyHolder"
github "Clipy/Magnet"
github "Clipy/Sauce"
```## Example
Set default key combo.
```swift
let recordView = RecordView(frame: CGRect.zero)
recordView.tintColor = NSColor(red: 0.164, green: 0.517, blue: 0.823, alpha: 1)
let keyCombo = KeyCombo(doubledModifiers: .command)
recordView.keyCombo = keyCombo
```Some delegate methods
```swift
func recordViewShouldBeginRecording(_ recordView: RecordView) -> Bool
func recordView(_ recordView: RecordView, canRecordShortcut keyCombo: KeyCombo) -> Bool
func recordView(_ recordView: RecordView, didChangeKeyCombo keyCombo: KeyCombo?)
func recordViewDidEndRecording(_ recordView: RecordView)
```Or you can use closures.
```swift
let recordView = RecordView(frame: CGRect.zero)
recordView.didChange = { keyCombo in
guard let keyCombo = keyCombo else { return } // Clear shortcut
// Changed new shortcut
}
```## Dependencies
The source code is dependent on hotkey library.
- [Magnet](https://github.com/Clipy/Magnet)
- [Sauce](https://github.com/Clipy/Sauce)## How to Build
1. Move to the project root directory
2. Install dependency library with `carthage` or `git submodule`
3. `carthage checkout --use-submodules` or `git submodule update --init --recursive`
4. Open `KeyHolder.xcworkspace` on Xcode.
5. build.