Skip to content

Instantly share code, notes, and snippets.

@jostyee
Forked from narze/karabiner_merge.sh
Created June 11, 2019 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jostyee/c0c85fac6b726d011b658e1484146e9f to your computer and use it in GitHub Desktop.
Save jostyee/c0c85fac6b726d011b658e1484146e9f to your computer and use it in GitHub Desktop.
Merge karabiner.json with complex modification rules
#!/usr/bin/env bash
# Requirements : goku, jq
# 1. Make sure goku runs
goku
# 2. Make temp json file
cp ~/.config/karabiner/karabiner.json ~/.config/karabiner/karabiner.tmp.json
# 3. Merge karabiner.json with ~/.config/karabiner/assets/complex_modifications/enabled/*.json
# Create `enabled` folder and put your desired json in there, those files will not be shown within karabiner ui
jq -s '.[0].profiles[0].complex_modifications.rules += reduce (.[1:] | .[].rules) as $a ([]; . + $a) | .[0]' ~/.config/karabiner/karabiner.tmp.json ~/.config/karabiner/assets/complex_modifications/enabled/*.json > ~/.config/karabiner/karabiner.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment