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 bind shortcuts application-specific instead of globally? #122

Closed JoeriBultheel closed 5 years ago

JoeriBultheel commented 5 years ago

Hi,

I love MASShortcut, but I want to have one of my shortcuts to not be active system-wide/globally but only when my app is in focus. Is there a possibility to set this in code somehow?

Thank you

shpakovski commented 5 years ago

Hi Joeri, please check this API: addLocalMonitorForEvents(matching:handler:). Does it help?

JoeriBultheel commented 5 years ago

Thank you!

I only knew about addGlobalMonitor... silly me. Would be nice to integrate this into MASShortcuts nonetheless imo.

Cheers

zoul commented 5 years ago

If I understand the issue correctly, adding a local handler for a MASShortcut should be fairly easy using the API linked to above, so I don’t feel like this is a must have in MASShortcut. Joeri, if you have a use case where additional support in MASShortcut would make life much easier for you, please reopen. Thank you!