Modern framework for managing global keyboard shortcuts compatible with Mac App Store. More details:
Objective-C
Switch branches/tags
Nothing to show
Pull request Compare This branch is 4 commits ahead, 238 commits behind shpakovski:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
MASShortcut+Monitoring.h
MASShortcut+Monitoring.m
MASShortcut+UserDefaults.h
MASShortcut+UserDefaults.m
MASShortcut.h
MASShortcut.m
MASShortcutView+UserDefaults.h
MASShortcutView+UserDefaults.m
MASShortcutView.h
MASShortcutView.m
README.md

README.md

MASShortcut - Non-ARC version

This fork of MASShortcut fixes some issues if you use it with a non-ARC project. If you're using ARC, see the original version at https://github.com/shpakovski/MASShortcut.

Intro

Some time ago Cocoa developers used a brilliant framework ShortcutRecorder for managing keyboard shortcuts in application preferences. However, it became incompatible with a new plugin architecture of Xcode 4.

The project MASShortcut introduces modern API and user interface for recording, storing and using global keyboard shortcuts. All code is compatible with Xcode 4.3, Mac OS X 10.7 and the sandboxed environment.

Usage

I hope, it is really easy:

// Drop a custom view into XIB and set its class to MASShortcutView
@property (nonatomic, weak) IBOutlet MASShortcutView *shortcutView;

// Think up a preference key to store a global shortcut between launches
NSString *const kPreferenceGlobalShortcut = @"GlobalShortcut";

// Assign the preference key and the shortcut view will take care of persistence
self.shortcutView.associatedUserDefaultsKey = kPreferenceGlobalShortcut;

// Execute your block of code automatically when user triggers a shortcut from preferences
[MASShortcut registerGlobalShortcutWithUserDefaultsKey:kPreferenceGlobalShortcut handler:^{

	// Let me know if you find a better or more convenient API.
}];

To set an example, I made a demo project: MASShortcutDemo. Enjoy!

Non-ARC Version

If you like retain/release, please check out the following fork: chendo/MASShortcut.

Copyright

MASShortcut is licensed under the BSD license.