I am trying to disable the system keyboard shortcuts with following code:
#import "AppDelegate.h"
#import "Carbon/Carbon.h"
@implementation AppDelegate
void *oldHotKeyMode;
@synthesize window = _window;
-(void)dealloc
{
[super dealloc];
}
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
oldHotKeyMode = PushSymbolicHotKeyMode(kHIHotKeyModeAllDisabled);
}
-(void)applicationWillTerminate:(NSNotification *)notification
{
PopSymbolicHotKeyMode(oldHotKeyMode);
}
@end
But it doesn’t work. What am i doing wrong?
The problem was in System Preferences. This code works only if you checked “Enable access for assistive devices” in “Universal Access”.