Skip to content

Instantly share code, notes, and snippets.

@JavaGT
Created July 20, 2026 08:48
Show Gist options
  • Select an option

  • Save JavaGT/9ab19c2a5f2f0a093fbb725a1adb1d8d to your computer and use it in GitHub Desktop.

Select an option

Save JavaGT/9ab19c2a5f2f0a093fbb725a1adb1d8d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
mkdir -p ~/.config/karabiner ~/.local/bin
cat > ~/.config/karabiner/karabiner.json <<'CONFIG'
{
"global": {
"check_for_updates_on_startup": false,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"name": "Default",
"selected": true,
"simple_modifications": {},
"fn_function_keys": [],
"virtual_hid_keyboard": {
"country_code": 0,
"mouse_key_xy_scale": 0
},
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_if_held_threshold_milliseconds": 150,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 1000
},
"rules": [
{
"description": "Caps Lock → Hyper + space navigation",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": ["any"]
}
},
"to_if_held": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
]
},
{
"description": "Hyper + A → move space left",
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"left_command",
"left_control",
"left_option",
"left_shift"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["left_control"]
}
]
},
{
"description": "Hyper + S → move space right",
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": [
"left_command",
"left_control",
"left_option",
"left_shift"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["left_control"]
}
]
}
]
}
]
}
}
]
}
CONFIG
# Create agentplans script
cp /tmp/agentplans.sh ~/.local/bin/agentplans 2>/dev/null || true
chmod +x ~/.local/bin/agentplans 2>/dev/null || true
# Clean up hidutil mapping if present
hidutil property --set '{"UserKeyMapping":[]}' 2>/dev/null || true
echo "✓ Karabiner config written to ~/.config/karabiner/karabiner.json"
echo ""
echo "Now open Karabiner-Elements.app and grant Input Monitoring:"
echo " open -a Karabiner-Elements"
echo "→ System Settings → Privacy & Security → Input Monitoring → check Karabiner"
echo ""
echo "Hold Caps Lock + A/S to switch spaces."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment