Skip to content

The only user interface control to record shortcuts. For Mac OS X 10.6+, 64bit

License

Notifications You must be signed in to change notification settings

gcox/ShortcutRecorder

 
 

Repository files navigation

CC BY 4.0 macOS 10.11 Mac App Store Approved

CocoaPods Compatible Carthage Compatible

Coverage Build Status

ShortcutRecorder

Showcase

The best control to record shortcuts on macOS

  • Objective-C framework developed with Swift in mind
  • Easily stylable
  • Translated into 23 languages
  • Supports macOS Accessibility
  • Thoroughly documented and tested
  • Mac App Store approved
  • End-to-end Interface Builder integration

What is inside

The framework comes with:

  • SRRecorderControl to render and capture user input
  • SRRecorderControlStyle for custom styling
  • SRShortcut that represents a shortcut model
  • SRGlobalShortcutMonitor to turn the shortcut into an action by registering a global hot key
  • SRLocalShortcutMonitor for manual handling in the responder chain and NSEvent monitors
  • SRShortcutController for smooth Cocoa Bindings and seamless Interface Builder integration
  • SRShortcutValidator to check validity of the shortcut against Cocoa key equivalents and global hot keys
  • NSValueTransformer and NSFormatter subclasses for custom alternations
import ShortcutRecorder

let defaults = NSUserDefaultsController.shared
let keyPath = "values.shortcut"
let options = [NSBindingOption.valueTransformerName: NSValueTransformerName.keyedUnarchiveFromDataTransformerName]

let beepAction = ShortcutAction(keyPath: keyPath, of: defaults) { _ in
    NSSound.beep()
    return true
}
GlobalShortcutMonitor.shared.addShortcutAction(beepAction)

let recorder = RecorderControl()
recorder.bind(.value, to: defaults, withKeyPath: keyPath, options: options)

recorder.objectValue = Shortcut(keyEquivalent: "⇧⌘A")

Integration

The framework supports module maps, explicit linking is not required: simply import ShortcutRecorder / #import <ShortcutRecorder/ShortcutRecorder.h>

CocoaPods

 pod 'ShortcutRecorder', '~> 3.0'

Carthage

github "Kentzo/ShortcutRecorder" ~> 3.0

Prebuilt frameworks are available.

Git Submodule

Add the submodule:

git submodule add git://github.com/Kentzo/ShortcutRecorder.git

Then drag'n'drop into Xcode workspace of your project.

Next Steps

  • The Documentation playground covers all parts of the framework (see in Xcode)
  • The Inspector app is useful during development of custom styles
  • Read about Styling and special notes regarding Cocoa's Key Equivalents.

Questions

Still have questions? Create an issue.

Paid Support

Paid support is available for custom alterations, help with integration and general advice regarding Cocoa development.

About

The only user interface control to record shortcuts. For Mac OS X 10.6+, 64bit

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 65.2%
  • Swift 34.4%
  • Other 0.4%