Closed chendo closed 10 years ago
Hello Jack, it looks like there is a key kHISymbolicHotKeyEnabled
which can help. Could you please try to modify some code in MASShortcut.m
to check how it works?
CFNumberRef code = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyCode);
CFNumberRef flags = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyModifiers);
CFNumberRef enabled = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyEnabled);
if (([(__bridge NSNumber *)code unsignedIntegerValue] == self.keyCode) &&
([(__bridge NSNumber *)flags unsignedIntegerValue] == self.carbonFlags) &&
([(__bridge NSNumber *)enabled boolValue] )) {
Sorry for the late reply.
Yeah, I stumbled across that key as well, although I wasn’t sure if the hotkey system was limited to one entry (regardless of active or not). I’ll have a go when I have the chance. Thanks!
On Monday, 7 April 2014 at 7:02 am, Vadim Shpakovski wrote:
Hello Jack, it looks like there is a key kHISymbolicHotKeyEnabled that can help. Could you please modify some code in MASShortcut.m to see if it works? CFNumberRef code = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyCode); CFNumberRef flags = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyModifiers); CFNumberRef enabled = CFDictionaryGetValue(hotKeyInfo, kHISymbolicHotKeyEnabled); if (([(bridge NSNumber *)code unsignedIntegerValue] == self.keyCode) && ([(bridge NSNumber )flags unsignedIntegerValue] == self.carbonFlags) && ([(__bridge NSNumber )enabled boolValue] )) {
Sorry for the late reply.
— Reply to this email directly or view it on GitHub (https://github.com/shpakovski/MASShortcut/issues/33#issuecomment-39680635).
Sorry for super late reply, but I've confirmed this fixes the issue!
I pushed the change, thanks!
When MASShortcut checks existing shortcuts for conflicts, it does not take in account whether or not the existing shortcut is enabled or not.
Use case:
Cmd+Option+Space
is taken by the system for "Select next source in input", but is disabled by default. However, trying to assign to this with MASShortcut will cause it to error. Is this because it's not possible to register a shortcut when one exists but is disabled?