DEV Community

Rafkat Galiullin
Rafkat Galiullin

Posted on

2

How to remap the F4 key to Launchpad from Spotlight automatically on start

Receipt:
Place code below to ~/Library/LaunchAgents/com.local.KeyRemapping.plist, if file not exist's you should create it.

<?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": 0x0C000002A2
            }
        ]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
Enter fullscreen mode Exit fullscreen mode

Restart your Mac and enjoy it!
:)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (2)

Collapse
 
jhoow profile image
jhoow

works like a charm for the magic keyboard with Touch ID. Thanks!

Collapse
 
matthew_williams_f613f779 profile image
Matthew Williams

Could this be done to boot a specific application or a key combination

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more