cocoabits / MASShortcut

Modern framework for managing global keyboard shortcuts compatible with Mac App Store. More details:
http://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html
BSD 2-Clause "Simplified" License
1.52k stars 220 forks source link

Possibility to receive an event on keyUp? #73

Closed alexpersian closed 8 years ago

alexpersian commented 9 years ago

I'm trying to build a utility using this library that will respond to a shortcut being pressed, but also handle when that shortcut is released.

The events themselves are given out through NSEvents as keyDown and keyUp, but attaching MASShortcut to a hotkey prevents the default NSEvents from firing.

Is it possible to gather the keyUp event from within MASShortcut?

zoul commented 9 years ago

We use the Carbon hotkeys API to detect the shortcut presses, see RegisterEventHotKey and friends. Take a look at the API, maybe you could do something there. If not, maybe you can use event taps to detect the shortcuts yourself? (See CGEventTapCreate.) Writing a simple shortcut detecting event tap is not hard and you could still use all other MASShortcut components such as recording and storage.

zoul commented 8 years ago

I’m closing this issue, feel free to reopen if you need more assistance.