MacBook 的左侧选项(alt 键)总是被按下 - 不是机械地按下,但我猜它正在生成按键事件。屏幕键盘显示选项键已按下(有红色边框)。因此,在mac登录屏幕(密码屏幕)中,由于按下了选项键,所以输入的密码字符变成特殊字符(例如,w变成Σ)。
因此,我使用as禁用了左选项键,hidutil
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000E2,
"HIDKeyboardModifierMappingDst":0x700000000}]}'
我已将其制作成 plist 脚本并使用加载它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>
我已将其加载为
launchctl load ~/Library/LaunchAgents/local.hidutilKeyMapping.plist
即使我设置RunAtLoad
为true,它也只有在我登录后才会生效。
我想在启动时应用键映射(禁用左侧选项键),即在苹果徽标出现期间/之前。
我试过plist
把
~/Library/LaunchAgents
/Library/LaunchDaemons
这两个选项似乎都不起作用,即在我通过密码屏幕之前不会应用键映射。
如何在启动时调用此 plist 脚本?
注意:我已暂时将密码重置为仅包含特殊字符以允许输入密码。
设置对我有用
LimitLoadToSessionType
。StandardIO