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

Can't capture numbers and letters #113

Open cristibaluta opened 6 years ago

cristibaluta commented 6 years ago

Hi, I'm building an app that when is visible (it's a borderless window so even if he app is front most the active app is the one behind it) it captures all the important keys and does something with them. All works fine except when I enable the sandbox, then only the arrows and backspace and enter is captured, if I type letters and numbers they go to the active app. Is this a limitation of sandboxed apps or i'm doing something wrong?

jhoughjr commented 6 years ago

I'm having a similar issue, no sandbox, non menu bar app. The MASShortcutView only accepts modifier keys and dunks for any alphanumeric.

Elpidam commented 5 years ago

@jhoughjr This is because MASShortcutView uses RegisterEventHotKey Carbon function which, by definition, registers modifier keys + alphanumerics or keys like space or Tab which are neither alphanumeric nor modifier keys. I wish there was a way to capture just an alphanumeric without any modifier key involved. Some apps do it (not sandboxed ones).

cristibaluta commented 5 years ago

I think is not about what MAS uses but about the sandbox, if they allow this some random utility in your status bar could steal what you type in other apps. You can capture any key if is not a sandboxed app, not sure why you say you wish you can, i'm using. this to populate a search field when my borderless app is on screen