Can't assign normal keyboard shortcuts on Monterey because "it's already used by a system-wide keyboard shortcut"
I just bought a new MacBook and it came with Monterey installed. Normally, I would set up "Cmd+\" to map to the 1Password Mini browser, to retrieve passwords. I also have shortcuts set up for Divvy - "Cmd+E" brings up the Divvy window, and then "S" assigns the window to the left half of the screen, "F" to the right half, "R" to the top right corner, etc.
When I try to assign any of these shortcuts, I get a system dialog informing me that the shortcut I have tried to assign cannot be used because "it's already used by a system-wide shortcut."
I pulled up the Keyboard preferences and went to Shortcuts and scrolled the entire list and didn't see anything conflicting. I also opened the "Shortcuts" app but I do not have any shortcuts installed.
What do I need to do to get my keyboard shortcuts working again?
Solution 1:
The behavior your are seeing is consistent with changes Apple has made in macOS Monterey, as compared to macOS Big Sur, to its assigned global system keyboard shortcuts as mentioned in a comment by Mateusz Szlosek.
For example, the following keyboard shortcuts are a few that are new to macOS Monterey:
Menu Item | Keyboard Shortcut |
---|---|
Start Dictation… | fn D |
Emoji & Symbols | fn E |
Enter Full Screen | fn F |
However, there is an inconstancy in what macOS reports when trying to assign a single character non-global keyboard shortcut in Divvy, in that while trying to assign, e.g., S or F it reports, e.g. for S, and the same for F (with it in its place appropriately).
The key combination S can't be used!
The key combination "S" can't be used because it's already used by a system-wide keyboard shortcut. (If you really want to use this key combination, most shortcuts can be changed in the Keyboard & Mouse panel in System Preferences.)
Yet it allows one to assign the single character non-global keyboard shortcut D even though its assigned to: Start Dictation…
Although there is a workaround, the following individual alpha characters and other characters, by default in macOS Monterey, can not be used as a single character keyboard shortcut when trying to assign one in Divvy:
A C F H M N Q S ` \ ← ↑ ↓ →
Solutions
-
To resolve your issue the obvious answer is to use a different single character keyboard shortcut, as non-global, or use in conjunction with modifier keys.
-
If possible, modify the existing global system keyboard shortcuts in System Preferences > Keyboard > Shortcuts > App Shortcuts to free up the single character for use in Divvy.
-
Another option is to restore the preferences for Divvy from a backup of the
~/Library/Preferences/com.mizage.direct.Divvy.plist
file from your previous system, which I have tested and it works. Note that in doing so one must first quit Divvy, restore the aforementioned.plist
file, and one must reboot directly after restoring the file. (Yes, in this case, a reboot is required.) -
Yet another option is to edit the aforementioned
.plist
file, which I have in limited testing in a virtual machine been successful in doing.
Editing com.mizage.direct.Divvy.plist
This section of the answer is for proof of concept, and directions on how I made the example edit.
The contents of the aforementioned .plist
file, in its XML Property List format, with having set ⌘E as the global keyboard shortcut to bring up Divvy, and no other setting changes, shows as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SULastCheckTime</key>
<date>2021-11-08T13:02:01Z</date>
<key>enableAcceleration</key>
<true/>
<key>globalHotkey</key>
<dict>
<key>keyCode</key>
<integer>14</integer>
<key>modifiers</key>
<integer>256</integer>
</dict>
<key>useGlobalHotkey</key>
<true/>
</dict>
</plist>
Then with adding a single character non-global keyboard shortcut L assigned to Left Half, which consists of the left half of the screen in is default configuration, in its XML Property List format, it shows as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SULastCheckTime</key>
<date>2021-11-08T13:03:32Z</date>
<key>enableAcceleration</key>
<true/>
<key>globalHotkey</key>
<dict>
<key>keyCode</key>
<integer>14</integer>
<key>modifiers</key>
<integer>256</integer>
</dict>
<key>shortcuts</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGmCwwSKSoxVSRudWxs0g0ODxFa
TlMub2JqZWN0c1YkY2xhc3OhEIACgAXdExQVFhcOGBkaGxwdHh8gISIiJCUmHycoISFY
c2l6ZVJvd3NfEA9zZWxlY3Rpb25FbmRSb3dfEBFzZWxlY3Rpb25TdGFydFJvd1pzdWJk
aXZpZGVkVmdsb2JhbF8QEnNlbGVjdGlvbkVuZENvbHVtbldlbmFibGVkW3NpemVDb2x1
bW5zV25hbWVLZXlca2V5Q29tYm9Db2RlXxAUc2VsZWN0aW9uU3RhcnRDb2x1bW5da2V5
Q29tYm9GbGFncxAGEAUQAAgIgAQQAgmAAxAlWUxlZnQgSGFsZtIrLC0uWiRjbGFzc25h
bWVYJGNsYXNzZXNYU2hvcnRjdXSiLzBYU2hvcnRjdXRYTlNPYmplY3TSKywyM15OU011
dGFibGVBcnJheaMyNDVXTlNBcnJheVhOU09iamVjdAAIABEAGgAkACkAMgA3AEkATABR
AFMAWgBgAGUAcAB3AHkAewB9AJgAoQCzAMcA0gDZAO4A9gECAQoBFwEuATwBPgFAAUIB
QwFEAUYBSAFJAUsBTQFXAVwBZwFwAXkBfAGFAY4BkwGiAaYBrgAAAAAAAAIBAAAAAAAA
ADYAAAAAAAAAAAAAAAAAAAG3
</data>
<key>useGlobalHotkey</key>
<true/>
</dict>
</plist>
The settings for the user created keyboard shortcuts are stored in the shortcuts
key, which is binary PLIST data, just like any other individual binary PLIST file, but embedded within. It is in this data that one can change the e.g. single character non-global keyboard shortcut, e.g., L to S.
Extracted shortcuts
data , in its XML Property List format, shows as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>$archiver</key>
<string>NSKeyedArchiver</string>
<key>$objects</key>
<array>
<string>$null</string>
<dict>
<key>$class</key>
<dict>
<key>CF$UID</key>
<integer>5</integer>
</dict>
<key>NS.objects</key>
<array>
<dict>
<key>CF$UID</key>
<integer>2</integer>
</dict>
</array>
</dict>
<dict>
<key>$class</key>
<dict>
<key>CF$UID</key>
<integer>4</integer>
</dict>
<key>enabled</key>
<true/>
<key>global</key>
<false/>
<key>keyComboCode</key>
<integer>37</integer>
<key>keyComboFlags</key>
<integer>0</integer>
<key>nameKey</key>
<dict>
<key>CF$UID</key>
<integer>3</integer>
</dict>
<key>selectionEndColumn</key>
<integer>2</integer>
<key>selectionEndRow</key>
<integer>5</integer>
<key>selectionStartColumn</key>
<integer>0</integer>
<key>selectionStartRow</key>
<integer>0</integer>
<key>sizeColumns</key>
<integer>6</integer>
<key>sizeRows</key>
<integer>6</integer>
<key>subdivided</key>
<false/>
</dict>
<string>Left Half</string>
<dict>
<key>$classes</key>
<array>
<string>Shortcut</string>
<string>NSObject</string>
</array>
<key>$classname</key>
<string>Shortcut</string>
</dict>
<dict>
<key>$classes</key>
<array>
<string>NSMutableArray</string>
<string>NSArray</string>
<string>NSObject</string>
</array>
<key>$classname</key>
<string>NSMutableArray</string>
</dict>
</array>
<key>$top</key>
<dict>
<key>root</key>
<dict>
<key>CF$UID</key>
<integer>1</integer>
</dict>
</dict>
<key>$version</key>
<integer>100000</integer>
</dict>
</plist>
To change the single character, e.g., L to S one would modify the keyComboCode
key from 37
to 1
. List of Key Codes
Setting aside any third-party applications/utilities that exist to manipulate Property List Files, and even Apple's own Xcode as not everyone wants to install a 30+GB application, here are some of the Apple built-in command line utilities and applications that can to one degree or another work with Property List Files.
/usr/bin/defaults
/usr/bin/plutil
/usr/libexec/PlistBuddy
- Terminal
- Script Editor
- System Events
- TextEdit
- Other native command line utilities that can be used in conjunction with the others mentioned.
Note: The following is not intended to offer a fully automated programatic solution to editing the target binary PLIST file, far from it, and is going to be a multi-step process to make the edit(s).
Having quit Divvy...
In Terminal
- Backup the existing target binary PLIST file.
cd ~/Library/Preferences/
cp -anv com.mizage.direct.Divvy.plist com.mizage.direct.Divvy.plist.bak
• Hint: Copy and paste the commands into Terminal, then press: enter
In Script Editor
- Create a new document and run the following example AppleScript code to create a file containing the data of the
shortcuts
key. Just copy and paste, then run it (⌘R). No editing necessary. - This will create the file
~/divvy.shortcuts.plist
from theshortcuts
key in the~/Library/Preferences/com.mizage.direct.Divvy.plist
file. It is just a temporary file to make the edit(s) and update the.plist
file used by Davvy, then is deleted.
Example AppleScript code:
property bPlistFile : "com.mizage.direct.Divvy.plist"
property bPlistData : missing value
property thePropertyListFilePath : POSIX path of ¬
("" & (path to preferences from user domain) & bPlistFile)
property bPlistDataShortcuts : POSIX path of ¬
("" & (path to home folder) & "divvy.shortcuts.plist")
tell application "System Events"
tell property list file thePropertyListFilePath
set bPlistData to the value of property list item "shortcuts"
end tell
end tell
writeToFile(bPlistData, bPlistDataShortcuts, true)
-- ## Handler ##
on writeToFile(theData, theFile, overwriteExistingContent)
try
set theFile to theFile as string
if theFile contains "/" then
set theOpenedFile to open for access theFile with write permission
else
set theOpenedFile to open for access file theFile with write permission
end if
if overwriteExistingContent is true then set eof of theOpenedFile to 0
write theData to theOpenedFile starting at eof
close access theOpenedFile
return true
on error
try
close access file theFile
end try
return false
end try
end writeToFile
Back in Terminal
cd ..
plutil -convert xml1 divvy.shortcuts.plist
open -e divvy.shortcuts.plist
• Hint: Copy and paste the commands into Terminal, then press: enter
In TextEdit
-
Looking for
<key>keyComboCode</key>
followed by e.g.<integer>37</integer>
where37
represents the key code forL
and change37
to1
, the key code forS
. -
Save and close the file.
Back in Terminal
plutil -convert binary1 divvy.shortcuts.plist
defaults delete com.mizage.direct.Divvy 'shortcuts'
defaults write com.mizage.direct.Divvy 'shortcuts' -data "$(xxd -p 'divvy.shortcuts.plist' | tr -d '\n')"
rm divvy.shortcuts.plist
• Hint: Copy and paste the commands into Terminal, then press: enter
Finishing up
Now reboot the Mac and one will be all set and ready to go, happily using a single character non-global keyboard shortcut in Divvy, that one could not assign from the preferences in Divvy.
Notes:
While I wrote the directions in mind to use all macOS native applications/command line utilities, nonetheless I highly recommend using an editor that provides syntactical highlighting to edit the XML Plist data. BBEdit is what I used.
While this is an example where only one user created single character keyboard shortcut was created and subsequently edited, nonetheless, keep in mind the hierarchical XML structure for each user created single character keyboard shortcut and be sure you are editing the correct one.
This was all done in virtual machines and and such there are no guaranties expressed or implied that the single character non-global keyboard shortcuts edited as described herein will be free of conflict on physical hardware. At this time I am unable to test on physical hardware.
I am not affiliated with the developer of BBEdit, just a satisfied user of the product.