The left option (alt key) of the MacBook is always pressed - not mechanically, but I guess it is generating the key press event. The on-screen keyboard shows the option key is pressed (has red border). Hence in the mac login screen (password screen), since the option key is pressed, the entered password characters become special characters (e.g., w become ∑).
Hence, I have disabled the left option key using hidutil as,
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000E2,
"HIDKeyboardModifierMappingDst":0x700000000}]}'
I have made this into a plist script and loaded it using launchctl
<?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>local.hidutilKeyMapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--matching</string>
<string>{"ProductID":0x1234}</string> <!-- Replaced with actual product id -->
<string>--set</string>
<string>{"UserKeyMapping":[
{
"HIDKeyboardModifierMappingSrc": 0x7000000E2,
"HIDKeyboardModifierMappingDst": 0x700000000
}
]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I've loaded it as
launchctl load ~/Library/LaunchAgents/local.hidutilKeyMapping.plist
Even though I have RunAtLoad set to true, it doesn't take effect until I've logged in.
I would like to have the key mapping applied (disable the left option key) during the boot time itself, i.e., during/before the apple logo appears.
I've tried placing the plist in
~/Library/LaunchAgents/Library/LaunchDaemons
Both options don't seem to work i.e., key mapping is not applied until I get past the password screen.
How to invoke this plist script during boot time?
Note: I've temporarily reset the password to contain only special characters to enable entering the password.