Intercepting a system keyboard shortcut

??/ opens a help screen and ?H hides the app. Is there a way to intercept and disable those keystrokes?

open the helpscreen-Window with showmodal (Window must be Type: “Modal Dialog” or “moveable Modal”)

Thanks for your reply, Robert, but I don’t think you understand my question. I want to prevent the (It’s actually a Search Window) from opening with that combination of keystrokes.

AFAIK, Cmd-H is a system level keyboard shortcut. Mac keyboard shortcuts - Apple Support

What you want to do requires placing a hook on the Mac OS X keyboard events to suppress the keystrokes at the system level. Given the protective attitude of Apple concerning such things, I have no idea if this is even possible, and would bet that such a thing would be highly taboo in the MAS.

I found this, but have no idea if it can help.

Cmd-shift-slash seems to be an app specific shortcut. I looks as if it would be necessary to intercept keyboard events too, but have no idea how/if this is possible.

Utilities such as Keyboard Maestro seem to be able to plug key punches in, but I have no idea if it can suppress any.

Oh - understnd, you want to block system-shortcuts.

I would recommend not to do this, because I had already circumstances, where I was glad, that a key (in windows) like ALT-F4 worked and I could kill the App …

Your application has no clue this key sequence was pressed - your app never sees it - the system uses it before your app has any opportunity to do anything

Thank you all for your discussion. I originally told the customer that it couldn’t be done, but now I’ve confirmed that here.

On mac you can intercept hotkeys. I use a stripped down version here from the original from Thomas Tempelmann here.

These use Carbon declares to InstallEventHandler and RegisterEventHotKey but they work in Cocoa apps too. The more modern way is with CGEventTaps but I haven’t tried them.

A problem with these Carbon declares in Cocoa is that returning eventNotHandledErr (-9874) from the handler is supposed to let the event continue on to its target, but it doesn’t. The installed hotkeys are always eaten. I imagine CGEventTaps don’t suffer this.

Thanks for that add’l info, Will. I have firmly decided that the potential downside to fiddling with system events far outweighs the benefits in my particular case.