Reputation: 2435
I have a user specified global hotkey and want to check and make sure it's not going to collide with other applications. Is there any API that can ask other applications for their shortcuts or am I stuck manually checking if the selected shortcut is a common one (Cmd+v, Cmd+C etc.)?
Thanks
Upvotes: 0
Views: 251
Reputation: 171
You have to ask the responder chain, in particular [NSResponder tryToPerform:with:] method will return if anything handles your action. Don't worry about what other apps are doing, just check if the user's shortcut is already in use.
tryToPerform:with: Attempts to perform the action indicated method with a specified argument.
Discussion If the receiver responds to anAction, it invokes the method with anObject as the argument and returns YES. If the receiver doesn’t respond, it sends this message to its next responder with the same selector and object.
Availability Available in OS X v10.0 and later. See Also – doCommandBySelector: sendAction:to:from: (NSApplication) Declared In NSResponder.h
Upvotes: 1