hidutil property --set '{"CapsLockDelayOverride":200}'
this works pretty well, you have to intentionally press hard on the capslock to activate it, so it wont press randomly with your pinky finger or something. sorry about the delay btw. to make this run on startup and refresh every 30 seconds though, you should run:
mkdir -p ~/Library/LaunchAgents
cat > ~/Library/LaunchAgents/com.local.capslock-delay.plist <<'EOF'
<?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.capslock-delay</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--set</string>
<string>{"CapsLockDelayOverride":200}</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>30</integer>
</dict>
</plist>
EOF
and then you should run:
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.local.capslock-delay.plist 2>/dev/null
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.local.capslock-delay.plist
and then to check if its actually working, you run:
hidutil property --get CapsLockDelayOverride
ill also post the launchd agent for the no delay one.