Hi! This may be an issue for others, and I'm wondering if there would be some enhancement which would avoid the issue eventually..
I use this tool a bit differently, registering many keys using the Monitor directly, not UserDefautls. I add the global monitor, using
[MASShortcut addGlobalHotkeyMonitorWithShortcut:self.shortcutView.shortcutValue
But when I try to delete the existing one (by hitting the shortCutView's Delete button and try to unregister the shortcut like so:
[MASShortcut removeGlobalHotkeyMonitor:theObject.keyShortcut];
where keyShortcut is a stored version of the actual MASShortcut object, I get the following when trying to remove it. The key in the Dictionary doesn't match as it is being interpreted as raw Unicode (here with CTRL-SHIFT-9)
The dictionary of current keys:
{
"\U2303\U21e79" = "<MASShortcutHotKey: 0x104332040>";
}
The actual key I'm trying to match to remove ('monitor' in + (void)removeGlobalHotkeyMonitor:(id)monitor)
Monitor: ⌃⇧9
All I'm doing is registering the shortcut using the MASShortcut itself as the monitor.
The issue is that when your code stores the MASShortcut as the Dictionary's Key, it uses its description, not the actual unicode keyvalue. But when trying to match with the appropriate key in the dictionary, it uses something else. In the end, the two strings do not match and the monitor doesn't get removed.
The workaround is quite simple, I store the description of the key like this:
[MASShortcut addGlobalHotkeyMonitorWithShortcut:self.shortcutView.shortcutValue.description
and thus, things get matched appropriately.
Maybe there are changes to be made to make this a bit more direct? Or maybe I'm going about this wrongly.
In the end it works great, but one has to understand that it is not the keyValue which is used as the dictionary's key, but the description.
Thoughts?
thanks for a great tool!
-Renaud