Skip to content

uphy/karabiner-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

karabiner-config

Generate karabiner-Elements configuration file with simple syntax.

karabiner-Elements is a great keyboard customization tool but its configuration file is a little redundant and hard to maintain.

karabiner-config generates the configuration file from more simple and readable configuration file.

  • YAML format
  • Commonize conditions between multiple manipulators (e.g., frontmost_application_if, frontmost_application_unless)
  • Shorten frequently used configurations
    • Set variable
    • Condition based on variable
    • Condition based on frontmost application
  • In manipulator configuration switch
  • Delayed to
  • Tag-based manipulator management

Installation

Binary

See release page.

Build

$ git clone https://github.com/uphy/karabiner-config
$ cd karabiner-config
$ make install

Getting Started

Create new rule file. This example defines keybinding Control-m to start a new line.

sample/instruction/01_c-m.yml

title: Control+M to newline
maintainers:
  - uphy
rules:
  - description: Control+H to newline
    manipulators:
      - from:
          key: C-m
        to:
          - key: return_or_enter

Then import this rule to the existing karabiner config.

Note: This command replaces your karabiner config's Default profile directly. Please back up first.

$ karabiner-config sample/instruction/01_c-m.yml ~/.config/karabiner/karabiner.json

Also you can watch changes of the yaml file and automatically update the karabiner config with -w option.

$ karabiner-config -w sample/instruction/01_c-m.yml ~/.config/karabiner/karabiner.json

In the terminal, most of shell supports the Control-m by default. So, disable the keybinding.

sample/instruction/01_c-m.yml

        - from:
            key: C-m
          to:
            - key: return_or_enter
+         conditions:
+           - app_unless:
+               identifiers:
+                 - ^com\\.apple\\.Terminal$

After save this rule file, your karabiner config will be automatically updated.

Rule file

The rule file structure is same as Karabiner-Elements.

But there are some improvements.

YAML format

Commonize conditions between multiple manipulators

Shorten frequently used configurations

Keybindings

Set variable

Condition based on variable

Condition based on frontmost application

In manipulator configuration switch

Delayed to

Tag-based manipulator management