Following is a sample of LaungAgent that remaps do not disturb key to Siri (I am using Type to Siri)
This is a lightweight solution not relying on external apps.
- Create
~/Library/LaunchAgents/com.local.KeyRemapping.plist
- Edit it to have following content
<?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>Label</key>
<string>com.local.KeyRemapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--set</string>
<string>{"UserKeyMapping":[
{
"HIDKeyboardModifierMappingSrc": 0xC00000221,
"HIDKeyboardModifierMappingDst": 0x700000068
},
{
"HIDKeyboardModifierMappingSrc": 0x10000009B,
"HIDKeyboardModifierMappingDst": 0x700000069
}
]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
This configuration will be loaded automatically every time macOS restarts, see Test Changes section if you want to experiment with alternative mappings
- Example above remaps
- Spotlight Key (π) to F13
- DND key (π) to F14
- If you are using Raycast
- Under Preferences β Raycast HotKey press Spotlight Key (F4 / π), you should see
- Remap Siri
- Navigate to System Preferences β Siri β Keyboard Shortcut β Custom
- Press DND key (F6 / π) - you should see F14 mapped as a shortcut
- Optionally enable "Type to Siri" under System Preferences β Accessibility
To remap multiple keys, add more elements under "UserKeyMapping"
To find hex values, follow documentation and section 10 of the HID USB tables (search for "Keyboard/Keypad Page (0x07)")
TLDR: value = 0x700000000 | key_code
- Loading:
launchctl load -w ~/Library/LaunchAgents/com.local.KeyRemapping.plist
- Unloading:
launchctl unload ~/Library/LaunchAgents/com.local.KeyRemapping.plist
- Printing currently active mappings
hidutil property --get "UserKeyMapping"
launchctl unload ~/Library/LaunchAgents/com.local.KeyRemapping.plist
rm ~/Library/LaunchAgents/com.local.KeyRemapping.plist
Thank you, works nice with Raycast