yqrashawn / GokuRakuJoudo

config karabiner with ease
GNU General Public License v3.0
1.14k stars 121 forks source link

Split configurations into multiple files and source them from the main file? #153

Open Abdiloki opened 2 years ago

Abdiloki commented 2 years ago

Is this something that is possible? My edn file is getting pretty long, it'd be neat to be able to split them into separate files based on application/layers. And then source them into the main file.

yqrashawn commented 2 years ago

It's not possible right now.

MatCyg commented 2 years ago

I had the same issue. I solved it with a bash script that combines all the files.

It is available here. In the main karabiner file I have i.e.: ;include:raise-layer.edn which is then replaced by the script with the content from raise-layer.edn file. The combined file is created in the /tmp/ directory and is deleted after it has been sourced by goku.

eugenesvk commented 1 year ago

another tip: using the great chezmoi dotfile manager with its includeTemplate function you can include all subtemplates to your main karabiner.edn.tmpl template like so:

(this assumes your env var is set to source karabiner.edn from a the custom ~/.config/path2goku/ folder)

<!-- content of karabiner.edn.tmpl at the same path as ↓ -->
{{- includeTemplate "./private_dot_config/path2goku/subtemplate1.edn.tmpl" . -}}
{{- includeTemplate "./private_dot_config/path2goku/subtemplate2.edn.tmpl" . -}}
{{- includeTemplate "./private_dot_config/path2goku/subtemplate3.edn.tmpl" . -}}
{{- includeTemplate "./private_dot_config/path2goku/subtemplate4.edn.tmpl" . -}}

Then after changing the subtemplates and running chezmoi to apply the changes, you will get a consolidated karabiner.edn in you config folder, then just run goku to add it to your karabiner.json

So after updating your configs, you can use this type of one liner to apply them chezmoi apply -v --interactive ~/.config/path2goku/karabiner.edn; goku