Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Hot keys for the modern cocoa developer.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 DGGHotKey.h
Octocat-spinner-32 DGGHotKey.m
Octocat-spinner-32 DGGKeyCodeTranslater.h
Octocat-spinner-32 DGGKeyCodeTranslater.m
Octocat-spinner-32 DGGKeyCombo.h
Octocat-spinner-32 DGGKeyCombo.m
Octocat-spinner-32 Readme.md
Readme.md

DGGHotKey

A super-simple, modern interface to system hot keys in cocoa.

Usage

The API, whilst horribly undocumented, is fairly trivial. Create a DGGKeyCombo using a keycode and modifier mask, then register it with a handler block.

Boom! Your block will be invoked whenever the hotkey is pressed.

You are returned an opaque pointer from the registration, hang onto it, you will need it if you wish to unregister the hotkey.

All Cocoa, All the Time

You don't have to worry about Carbon types or constants. For the modifier mask, use the constants defined in NSEvent.h, NSCommandKeyMask and friends.

Dependencies

You need to be linking the Carbon framework in your project.

 Tip of the Hat

This was all inspired by PTHotKey and the superb ShortcutRecorder.

License

Distributed under the MIT license.

Something went wrong with that request. Please try again.