Thanks to visit codestin.com
Credit goes to github.com

Skip to content

LearnDifferent/Karabiner-Elements

 
 

Repository files navigation

Build Status License

Mojave 使用的版本

版本 12.10.0 支持 Mojave 10.14.6:

设置复杂按键规则

自定义方法

参考资料:用 Karabiner Elements 自定义你的键盘作者博客

短按 Caps Lock 为切换输入法,长按 Caps LockControl 按键

参考资料:我用Karabiner:一个按钮,短按长按实现不同功能作者博客

设置短按 Caps Lock 为切换输入法,长按 Caps LockControl 按键:

  1. 创建配置文件:
vim ~/.config/karabiner/assets/complex_modifications/MyModifications.json
  1. 创建配置内容:
{
  "title": "My Modifications",
  "rules": [
        {
      "description": "Long press caps to control, short press caps to caps",
      "manipulators": [
        {
          "from": {
            "key_code": "caps_lock"
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "caps_lock"            
			}
          ],
          "type": "basic"
        }
      ]
    }
  ]
}
  1. 在 karabiner-elements 的 Complex modifications 中,点击 Add rule,选中创建的配置,然后点击 Enable

Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra or later.

Download

You can download Karabiner-Elements from official site.

Old releases

You can download previous versions of Karabiner-Elements from here.

Supported systems

  • macOS 11 Big Sur
  • macOS 12 Monterey

Usage

https://karabiner-elements.pqrs.org/docs/

Donations

If you would like to contribute financially to the development of Karabiner Elements, donations can be made via https://karabiner-elements.pqrs.org/docs/pricing/


For developers

How to build

System requirements to build Karabiner-Elements:

  • macOS 11+
  • Xcode 13+
    • Xcode for macOS Monterey is required.
    • Xcode 13 RC and Xcode 13.0 are not satisfy this requirements. As of Sep 2021, use Xcode 13 beta 5 at Sep 2021.
  • Command Line Tools for Xcode (xcode-select --install)
  • xz (brew install xz)
  • XcodeGen (brew install xcodegen)
  • CMake (brew install cmake)

Steps

  1. Get source code by executing a following command in Terminal.app.

    git clone --depth 1 https://github.com/pqrs-org/Karabiner-Elements.git
    cd Karabiner-Elements
    git submodule update --init --recursive --depth 1
  2. (Optional) If you have a codesign identity:

    1. Find your codesign identity.

      security find-identity -p codesigning -v | grep 'Developer ID Application'

      The result is as follows.

      1) 8D660191481C98F5C56630847A6C39D95C166F22 "Developer ID Application: Fumihiko Takayama (G43BCU2T37)"
      

      Your codesign identity is 8D660191481C98F5C56630847A6C39D95C166F22 in the above case.

    2. Set environment variable to use your codesign identity.

      export PQRS_ORG_CODE_SIGN_IDENTITY=8D660191481C98F5C56630847A6C39D95C166F22
    3. Find your codesign identity for installer signing.

      security find-identity -p basic -v | grep 'Developer ID Installer'

      The result is as follows.

      1) C86BB5F7830071C7B0B07D168A9A9375CC2D02C5 "Developer ID Installer: Fumihiko Takayama (G43BCU2T37)"
      

      Your codesign identity is C86BB5F7830071C7B0B07D168A9A9375CC2D02C5 in the above case.

    4. Set environment variable to use your codesign identity for installer signing.

      export PQRS_ORG_INSTALLER_CODE_SIGN_IDENTITY=C86BB5F7830071C7B0B07D168A9A9375CC2D02C5
  3. Build a package by executing a following command in Terminal.app.

    make package

    The make script will create a redistributable Karabiner-Elements-VERSION.dmg in the current directory.

Note: About pre-built binaries in the source tree

Karabiner-Elements uses some pre-built binaries in the source tree.

  • src/vendor/Karabiner-DriverKit-VirtualHIDDevice/dist/Karabiner-DriverKit-VirtualHIDDevice-*.dmg
  • Sparkle.framework in src/apps/PreferencesWindow/

Above make package command does not rebuild these binaries.
(These binaries will be copied in the distributed package.)

If you want to rebuild these binaries, you have to build them manually.
Please follow the instruction of these projects.

About

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 78.9%
  • Objective-C 11.3%
  • Swift 5.8%
  • C 1.4%
  • Shell 0.9%
  • Makefile 0.8%
  • Other 0.9%