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/functions_keys.json

View on GitHub
{
  "title": "Functions Keys",
  "rules": [

    {
      "description": "F4 to Cmd+Space",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f4"
          },
          "to": [
            {
              "key_code": "spacebar",
              "modifiers": [
                "left_command"
              ]
            }
          ]
        }
      ]
    },

    {
      "description": "Fn+F1 and Fn+F2 for Keyboard Brightness",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "fn"
              ]
            }
          },
          "to": [
            {
              "key_code": "illumination_decrement"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "fn"
              ]
            }
          },
          "to": [
            {
              "key_code": "illumination_increment"
            }
          ]
        }
      ]
    },
    
    {
      "description": "F6 for Focus mode, Sleep and Shut Down",
      "manipulators": [
        {
          "conditions": [
            {
              "name": "sleep",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "f6"
          },
          "to_after_key_up": [
            {
              "consumer_key_code": "eject",
              "modifiers": [
                "left_gui",
                "left_alt"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f6"
          },
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 200
          },
          "to": [
            {
              "set_variable": {
                "name": "sleep",
                "value": 1
              }
            }
          ],
          "to_delayed_action": {
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "sleep",
                  "value": 0
                }
              }
            ],
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "sleep",
                  "value": 0
                }
              },
              {
                "key_code": "f13"
              }
            ]
          },
          "to_if_held_down": [
            {
              "key_code": "f13"
            },
            {
              "halt": true,
              "key_code": "power",
              "modifiers": [
                "control"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },

    {
      "description": "Fn+F8 to open Spotify",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f8",
            "modifiers": {
              "mandatory": [
                "fn"
              ]
            }
          },
          "to_after_key_up": [
            {
              "shell_command": "open -a Spotify"
            }
          ]
        }
      ]
    },
    
    {
      "description": "Fn+F6 to Display Sleep",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f6",
            "modifiers": {
              "mandatory": [
                "fn"
              ]
            }
          },
          "to_after_key_up": [
            {
              "shell_command": "sleep 0.2 && pmset displaysleepnow"
            }
          ]
        }
      ]
    }
    
  ]
}