Generate and apply Karabiner-Elements SpaceFN configurations
Project description
karabiner-configurator
Python library and CLI to generate Karabiner-Elements complex modifications, with support for a SpaceFN layer and hostname-based config overrides.
Install
pip install karabiner-configurator
CLI
# Apply rules to Karabiner profile and generate index.html
karabiner-configurator
# Use a custom config directory
karabiner-configurator /path/to/config
# Only generate HTML visualization
karabiner-configurator --html-only
# Apply rules without generating HTML
karabiner-configurator --no-html
# Show informative logs
karabiner-configurator --verbose
# Only show errors
karabiner-configurator --quiet
By default, the CLI looks for:
config.default.json(required)config.<hostname>.json(optional)
Configuration is validated before rule generation; unknown definition keys fail fast with a clear error.
HTML rendering uses a Jinja template stored at
karabiner_configurator/templates/keyboard.html.j2.
Library Usage
from karabiner_configurator import (
main,
load_config,
apply_rules_to_karabiner,
generate_html_keyboard,
)
config = load_config("/path/to/config")
rules = main(config["spacefn_definitions"], config["normal_definitions"])
apply_rules_to_karabiner(rules, config.get("profile_name", "VIM"))
generate_html_keyboard(config, "index.html")
Development
# Install editable package + dev tooling
pip install -e ".[dev]"
# Enable default local checks on every commit
pre-commit install
# Lint (ruff, 120 cols)
ruff check .
# Optional formatting check
ruff format --check .
# Type check (mypy)
mypy
# Run tests
python -m unittest discover -s tests -v
# Build package artifacts
python -m pip install build
python -m build
GitHub + PyPI Release Setup
The repository is prepared with:
- CI workflow:
.github/workflows/ci.yml - Publish workflow:
.github/workflows/publish-pypi.yml - PEP 621 packaging in
pyproject.toml
One-time setup
- Create a PyPI project named
karabiner-configurator. - In PyPI project settings, add a trusted publisher for this GitHub repo and workflow:
.github/workflows/publish-pypi.yml. - In GitHub, keep the
pypienvironment (created by workflow) or create it with your preferred protections.
Publish
- Bump
versioninpyproject.toml. - Commit and push.
- Create and publish a GitHub Release.
- The
Publish to PyPIworkflow will build and upload the release to PyPI.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file karabiner_configurator-0.1.0.tar.gz.
File metadata
- Download URL: karabiner_configurator-0.1.0.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fecfd7f85c8815eec886b6382862f37d37ec65473baec39f9faaf4d09ef734e3
|
|
| MD5 |
17cd12d3bfb675062a5dcdd95e31c070
|
|
| BLAKE2b-256 |
3b6a95882b7dff5350d0636d850716ca4e4ab15471b12e0e74701ef7d4d0645a
|
Provenance
The following attestation bundles were made for karabiner_configurator-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on ea2809/karabiner-configurator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
karabiner_configurator-0.1.0.tar.gz -
Subject digest:
fecfd7f85c8815eec886b6382862f37d37ec65473baec39f9faaf4d09ef734e3 - Sigstore transparency entry: 1118116614
- Sigstore integration time:
-
Permalink:
ea2809/karabiner-configurator@d3d725692a6254b04b8e18832be84e01338c1c0f -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/ea2809
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d3d725692a6254b04b8e18832be84e01338c1c0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file karabiner_configurator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: karabiner_configurator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98d5920a1d7f6c968e623a0ff829920957358a893764ee1868bafdc14a4f110b
|
|
| MD5 |
d405af8716cbd296033a7260aabbc12e
|
|
| BLAKE2b-256 |
5645bb8fe53d4b9ff6c01f509dad18abc1f3983b2204ef673e64c95a76adcd9b
|
Provenance
The following attestation bundles were made for karabiner_configurator-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on ea2809/karabiner-configurator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
karabiner_configurator-0.1.0-py3-none-any.whl -
Subject digest:
98d5920a1d7f6c968e623a0ff829920957358a893764ee1868bafdc14a4f110b - Sigstore transparency entry: 1118116633
- Sigstore integration time:
-
Permalink:
ea2809/karabiner-configurator@d3d725692a6254b04b8e18832be84e01338c1c0f -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/ea2809
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d3d725692a6254b04b8e18832be84e01338c1c0f -
Trigger Event:
release
-
Statement type: