Config(fileopt)
User configuration of Karabiner-Elements
Constructor
new Config(fileopt)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
file opt
|
string |
'~/.config/karabiner/karabiner.json'
|
config file to read/write |
Members
currentProfile object
The current profile object
Methods
backup() → Config
Creates a backup of the config file with .bak
extension in the same directory as the original file.
If an old backup exists, it will be overwritten
Returns:
this
- Type:
- Config
clearRules() → Config
Clears all the rules in the current profile
Returns:
this
- Type:
- Config
deleteBackup() → Config
Deletes a backup file
Returns:
this
- Type:
- Config
load() → Config
Reads data from the config file
Returns:
this
- Type:
- Config
loadBackup() → Config
Restores data from a backup file
Returns:
this
- Type:
- Config
save() → Config
Writes the current data on the config file
Returns:
this
- Type:
- Config
setFile(file) → Config
Sets the config file path
Parameters:
Name | Type | Description |
---|---|---|
file
|
string | config file path |
Returns:
this
- Type:
- Config
setRules(rules) → Config
Sets the provided rules to the current profile
Parameters:
Name | Type | Description |
---|---|---|
rules
|
object[] | an array of rule definitions |
Returns:
this
- Type:
- Config