You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Remapping the F4 key to Launchpad from Spotlight automatically on start

Well, below written code works in Terminal but the key resets to Spotlight after every restart. I'd love to know if there is a permanent way to remap the Spotlight key(F4) to launchpad since CMD+Space is easy enough to remember :)


hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0xC00000221,"HIDKeyboardModifierMappingDst":0x0C000002A2}]}'

MacBook Pro 14″, macOS 12.0

Posted on Dec 23, 2021 4:42 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 13, 2022 7:19 PM

Guys if you want to change buttons F4 (launchpad), F5 (brightness low) and F6 (brightness up) as it was before on older Macs just add this code into your Library folder:

~/Library/LaunchAgents` saving the file with .plist extension (full name of file should be: com.local.KeyRemapping.plist)

It will Remapping your keyboard settings on launch of your system.


<?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": 0xC000000CF,
              "HIDKeyboardModifierMappingDst": 0xFF00000009
            },
            {
              "HIDKeyboardModifierMappingSrc": 0x10000009B,
              "HIDKeyboardModifierMappingDst": 0xFF00000008
            },
              {
              "HIDKeyboardModifierMappingSrc": 0xC00000221,
              "HIDKeyboardModifierMappingDst": 0x0C000002A2
            }
        ]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Similar questions

23 replies
Question marked as Top-ranking reply

Jan 13, 2022 7:19 PM in response to ataaral

Guys if you want to change buttons F4 (launchpad), F5 (brightness low) and F6 (brightness up) as it was before on older Macs just add this code into your Library folder:

~/Library/LaunchAgents` saving the file with .plist extension (full name of file should be: com.local.KeyRemapping.plist)

It will Remapping your keyboard settings on launch of your system.


<?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": 0xC000000CF,
              "HIDKeyboardModifierMappingDst": 0xFF00000009
            },
            {
              "HIDKeyboardModifierMappingSrc": 0x10000009B,
              "HIDKeyboardModifierMappingDst": 0xFF00000008
            },
              {
              "HIDKeyboardModifierMappingSrc": 0xC00000221,
              "HIDKeyboardModifierMappingDst": 0x0C000002A2
            }
        ]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Dec 24, 2021 6:50 AM in response to BlueberryLover

BlueberryLover wrote:

Couldn't you run an Apple Script via an Automator app to execute the required Terminal command (example below illustrates executing the "pwd" command)? The Automator app could then be set up as a login item (in Users & Groups System Preference).

- Pie Lover
P.S. I also found an article that may be of interest



https://discussions.apple.com/content/attachment/d44fd049-5e1c-4649-b355-9fec5d4641d6

So basically this is the end version after your suggestion, thanks for all the help from everyone:


Dec 24, 2021 1:53 AM in response to BlueberryLover

BlueberryLover wrote:

Couldn't you run an Apple Script via an Automator app to execute the required Terminal command (example below illustrates executing the "pwd" command)? The Automator app could then be set up as a login item (in Users & Groups System Preference).

- Pie Lover
P.S. I also found an article that may be of interest



https://discussions.apple.com/content/attachment/d44fd049-5e1c-4649-b355-9fec5d4641d6

I'll try it.

Dec 23, 2021 12:54 PM in response to Barney-15E

Barney-15E wrote:

On my Macs, the F4 key is Launchpad (or somewhere close to F4).
It's a complete waste for me because I can't understand why we needed a Launchpad in the first place.

Do you not have a Launchpad key already?

Well I like it, and no I don't. The new ones come with a Spotlight key instead of the launchpad key. CMD+Space was too hard I guess

Dec 24, 2021 4:59 AM in response to BlueberryLover

BlueberryLover wrote:

Couldn't you run an Apple Script via an Automator app to execute the required Terminal command (example below illustrates executing the "pwd" command)?

the problem with that is the code already includes quotation marks, so the first quotation mark ends the command right after hidutil property --set , i tried some other marks but couldn't find a way around it


edit: just putting a "\" before the quotation marks worked :)


Dec 24, 2021 5:38 AM in response to ataaral

I find this thread a bit surreal. F4 is not associated to Spotlight but to Launchpad.

I think the really relevant question is WHY in your system F4 invoked Spotlight in the first place?

There must be either: a) some corruption that prevents changing it back to Launchpad; or b) something that launches at startup or login and sets F4 to open Spotlight.


Does the problem also occur if you start in Safe Mode?

Remapping the F4 key to Launchpad from Spotlight automatically on start

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.