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 Best reply

Posted on Dec 24, 2021 6:50 AM

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:


Similar questions

23 replies
Question marked as Best reply

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?

Dec 27, 2021 7:11 PM in response to ataaral

For those like me who have never used Automator app.

1. Open Automator app > New document > Click on Quick Action and choose it.

2. Library > Run AppleScript > Copy and Paste the following:


on run {input, parameters}


tell application "Terminal"


activate


do script with command "hidutil property --set '{\"UserKeyMapping\":[{\"HIDKeyboardModifierMappingSrc\":0xC00000221,\"HIDKeyboardModifierMappingDst\":0x0C000002A2}]}'"


end tell


tell application "Terminal" to quit


return input

end run


3. Click play, the close automator. Spotlight key (F4) should pull up launchpad.

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 ID.