Karabiner: separate preferences file

Created on 11 May 2011  ·  15Comments  ·  Source: tekezo/Karabiner

It would be really cool to have an external configuration file with a list of all the checked options.

Purpose:

  • sync settings between machines (with dropbox, sugarsync, etc..)
  • backup and share configs (on github for example)

Most helpful comment

For others who might be interested, the url by @tekezo is broken, but this one works:
https://pqrs.org/osx/karabiner/document.html.en#commandlineinterface
(see "About export option" section).

Backup:

$ /Applications/Karabiner.app/Contents/Library/bin/karabiner export > ~/Desktop/karabiner-import.sh

Restore:

sh ~/Desktop/karabiner-import.sh

All 15 comments

About sync setting, didn't it put the plist file in Dropbox and symlink it?
~/Library/Preferences/org.pqrs.KeyRemap4MacBook.plist

About sharing, how about KeyRemap4MacBook_cli?
Though the UI is unkind, "changed" and "enable" options are useful.
(Known issue: enable options cannot control variables in number.xml such as repeat.wait.)

$ /Library/org.pqrs/KeyRemap4MacBook/app/KeyRemap4MacBook_cli.app/Contents/MacOS/KeyRemap4MacBook_cli changed
$ /Library/org.pqrs/KeyRemap4MacBook/app/KeyRemap4MacBook_cli.app/Contents/MacOS/KeyRemap4MacBook_cli enable XXX

It's an example of KeyRemap4MacBook_cli:
https://github.com/keqh/_config/blob/master/mac/keyremap4macbook.sh

About sync setting, didn't it put the plist file in Dropbox and symlink it?

Excuse me.
This approach will not work
because the symlink is unlinked and new regular plist file is created when we changed the configuration.

yup.. the configurations file has to be inside a symlinked folder.. for example on ~/Library/Application Support/Keyremap4macbook

In alternative there has to be an option, (like there is on 1Password, TextExpander, etc..) to save and keep the preferences in sync using dropbox. Or just a way of defining the location of the preferences file.

It has also to be version tolerant. It has to be able to simply ignore settings which are not recognized..

Oh! TextExpander is a great!

It is possible to do if we don't use NSUserDefaults (implement this function by ourself).
I'll change to put the setting file at ~/Library/Application Supprt/KeyRemap4MacBook/configuration.xml.
Then we can synchronize a file by the symlink approach.
I would like to do at version 7.4.0 or later.

Note for me: We must reload the setting file automatically when Dropbox updated it.
Unless reloading, a slave machine override the setting by previous version.

What's the status on this? I tried digging around but the latest version (8.0.0) doesn't put anything in ~/Library/Application Supprt/KeyRemap4MacBook/ besides private.xml.

This issue has not yet been implemented.

P.S.
I added "export" function to command line interface.
For now, you can dump settings into shell script by export function.
Then, you can share config by executing this script on another machine.
https://pqrs.org/osx/karabiner/document.html.en#commandlineinterface

Oh, I'd prefer a command line interface anyway---thanks = )

If you ever make it out to Portland, OR USA find me so I can get you a beer or coffee.

For others who might be interested, the url by @tekezo is broken, but this one works:
https://pqrs.org/osx/karabiner/document.html.en#commandlineinterface
(see "About export option" section).

Backup:

$ /Applications/Karabiner.app/Contents/Library/bin/karabiner export > ~/Desktop/karabiner-import.sh

Restore:

sh ~/Desktop/karabiner-import.sh

Thanks!
I've fixed the url.

Any updates on this? I am also looking for a way to specify either the folder of the plist file or symlink it into my dropbox

There is no progress.
(And I'm working on Sierra support, so I cannot take a time for this issue for a while.)

For those who want to sync Karabiner preferences with git (it should also work with Dropbox), I wrote a tool that can help: https://github.com/asmeurer/prefsync. I personally use it to sync my Karabiner prefs. For many things that I've tried it with it's a bit annoying to track their preferences in git because they are constantly writing things like timestamps to the pref file, but for Karabiner it works quite nicely (the pref file generally updates only when a pref is changed, or sometimes when Karabiner is updated). To use it run

prefsync ~/Library/Preferences/org.pqrs.Karabiner.plist /path/to/synced/org.pqrs.Karabiner.plist

Just to confirm, has anyone been able to use Mackup to sync the selected checkboxes?

I'm using mackup to sync preferences via Dropbox. The problem is that Karabiner is updating ~/Library/Preferences/org.pqrs.Karabiner.plist as it is being used and causing dropbox to work all the time. Why is Karabiner saving the state to the preferences file instead of keeping it only in memory?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikitavoloboev picture nikitavoloboev  ·  13Comments

tekezo picture tekezo  ·  22Comments

jeffmikels picture jeffmikels  ·  32Comments

affmarker picture affmarker  ·  20Comments

CedricGatay picture CedricGatay  ·  241Comments