Managing Karabiner Configuration with Goku (with examples)
- Osx
- November 5, 2023
Karabiner is a powerful keyboard customization tool for macOS that allows you to remap keys and create complex keyboard shortcuts. Goku is a command-line tool that helps manage the configuration of Karabiner. In this article, we will explore different use cases of the goku
command, highlighting its various features and options.
1: Generating karabiner.json
with default configuration
The following command generates the karabiner.json
file using the default configuration:
goku
Motivation: This command is useful when you want to generate the default karabiner.json
file without any customizations.
Explanation: The goku
command without any additional arguments or options generates the karabiner.json
file using the default configuration defined by Goku.
Example Output: After running the command, you will find the karabiner.json
file in the current directory containing the default configuration.
2: Generating karabiner.json
with a specific configuration file
To generate the karabiner.json
file using a specific configuration file, you can use the --config
option followed by the path to the desired configuration file. For example:
goku --config path/to/config.edn
Motivation: This command is useful when you want to use a custom configuration file instead of the default one provided by Goku. Custom configuration files allow you to define your own key mappings and complex shortcuts.
Explanation: By specifying the --config
option followed by the path to the desired configuration file, Goku will use that file instead of the default one. The configuration file can be in EDN format, which is an extensible data notation similar to JSON or YAML.
Example Output: After running the command, the karabiner.json
file will be generated using the configuration defined in the specified config.edn
file.
3: Dry run the new configuration to stdout
To preview the new configuration without updating the karabiner.json
file, you can use the --dry-run
option. This will output the configuration to the standard output (stdout) instead of updating the file. For example:
goku --dry-run
Motivation: This command is useful when you want to see the changes made by the new configuration without actually modifying the karabiner.json
file. It allows you to review and validate the changes before applying them.
Explanation: The --dry-run
option instructs Goku to perform a dry run, meaning it will simulate the configuration update process without modifying the karabiner.json
file. The updated configuration will be printed to the standard output (stdout) instead.
Example Output: Running the command will display the updated configuration on the terminal screen, allowing you to review and verify the changes.
4: Dry run the whole configuration to stdout
Similar to the previous use case, you can use the --dry-run-all
option to perform a dry run for the whole configuration. This will show the combined result of all configuration files and macros. Here’s the command:
goku --dry-run-all
Motivation: This command is useful when you have multiple configuration files and macros and want to verify the combined result without updating the karabiner.json
file.
Explanation: The --dry-run-all
option performs a dry run for the entire configuration, including all the included configuration files and macros. It allows you to see the combined result without modifying the karabiner.json
file.
Example Output: When running the command, the combined configuration from all the files and macros will be displayed on the terminal screen, providing a preview of the final configuration.
5: Displaying help information
If you need help or want to learn more about the goku
command and its options, you can use the --help
option. Here’s the command:
goku --help
Motivation: This command is useful when you need information about the available options and how to use them. It provides a quick reference to help you understand the command’s functionality.
Explanation: The --help
option displays the help information for the goku
command. It provides details about the available options, their descriptions, and examples of how to use them.
Example Output: Running the command will print the help information, including usage examples and descriptions of each option on the terminal screen.
6: Displaying version information
To check the version of the goku
command you have installed, you can use the --version
option. Here’s the command:
goku --version
Motivation: This command is useful when you want to verify the version of the goku
command installed on your system. It allows you to check if you have the latest version or if an update is available.
Explanation: The --version
option displays the version information for the goku
command. It shows the current version number, which can be compared with the latest release to check for updates.
Example Output: Running the command will print the version number of the goku
command on the terminal screen, providing confirmation of the installed version.