Explore the source / dotfiles

Inside dotfiles.

Shell, terminal, backup, and the configuration that joins them. Browse the current public files here, or visit the dotfiles repository on GitHub.

dotfiles / main

home/.config/karabiner/assets/complex_modifications/lock.json

View on GitHub
{
  "title": "Toggle Keyboard Lock with Cmd+Shift+Ctrl+Opt+Fn+L",
  "rules": [
    {
      "description": "Lock keyboard with Cmd+Shift+Ctrl+Opt+Fn+L (if not already locked)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": ["command", "shift", "control", "option", "fn"]
            }
          },
          "conditions": [
            {
              "type": "variable_if",
              "name": "keyboard_locked",
              "value": 0
            }
          ],
          "to": [
            {
              "set_variable": {
                "name": "keyboard_locked",
                "value": 1
              }
            }
          ]
        }
      ]
    },
    {
      "description": "Unlock keyboard with Cmd+Shift+Ctrl+Opt+Fn+L (if locked)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": ["command", "shift", "control", "option", "fn"]
            }
          },
          "conditions": [
            {
              "type": "variable_if",
              "name": "keyboard_locked",
              "value": 1
            }
          ],
          "to": [
            {
              "set_variable": {
                "name": "keyboard_locked",
                "value": 0
              }
            }
          ]
        }
      ]
    },
    {
      "description": "Disable all keys when keyboard is locked",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "any": "key_code"
          },
          "conditions": [
            {
              "type": "variable_if",
              "name": "keyboard_locked",
              "value": 1
            }
          ],
          "to": [
            {
              "key_code": "vk_none"
            }
          ]
        }
      ]
    },
    {
      "description": "Remap Cmd+Shift+Ctrl+Opt+Fn+L to F19",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "command",
                "shift",
                "control",
                "option",
                "fn"
              ]
            }
          },
          "to": [
            {
              "key_code": "f19"
            }
          ]
        }
      ]
    }
  ]
}