diff --git a/.envrc b/.envrc index 19c420a..a156678 100644 --- a/.envrc +++ b/.envrc @@ -3,4 +3,6 @@ export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m' # Use flake use flake -watch_file keymap_drawer.nix + +# Watch additional files +watch_file draw/default.nix diff --git a/.gitignore b/.gitignore index 148376e..f231cd4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ modules firmware zmk +# Ignore keymap-drawer output for now +draw/base.svg +draw/base.yaml diff --git a/Justfile b/Justfile index 43cc5a9..261427f 100644 --- a/Justfile +++ b/Justfile @@ -4,6 +4,7 @@ default: config := absolute_path('config') build := absolute_path('.build') out := absolute_path('firmware') +draw := absolute_path('draw') # parse combos.dtsi and adjust settings to not run out of slots _parse_combos: @@ -75,6 +76,13 @@ clean: clean-nix: nix-collect-garbage --delete-old +# parse & plot keymap +draw: + #!/usr/bin/env bash + set -euo pipefail + keymap -c "{{ draw }}/config.yaml" parse -z "{{ config }}/base.keymap" >"{{ draw }}/base.yaml" + keymap -c "{{ draw }}/config.yaml" draw "{{ draw }}/base.yaml" -k "ferris/sweep" >"{{ draw }}/base.svg" + # initialize west init: west init -l config diff --git a/draw/config.yaml b/draw/config.yaml new file mode 100644 index 0000000..ee94942 --- /dev/null +++ b/draw/config.yaml @@ -0,0 +1,8 @@ +parse_config: + zmk_preamble: "#include " + zmk_additional_includes: + - "modules/helpers/include" + +draw_config: + footer_text: "urob/zmk-config" + dark_mode: auto diff --git a/keymap_drawer.nix b/draw/default.nix similarity index 100% rename from keymap_drawer.nix rename to draw/default.nix diff --git a/img/keymap.png b/draw/keymap.png similarity index 100% rename from img/keymap.png rename to draw/keymap.png diff --git a/flake.nix b/flake.nix index cb94ae4..9d4d993 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ devShells = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; zephyr = zephyr-nix.packages.${system}; - keymap_drawer = pkgs.python3Packages.callPackage ./keymap_drawer.nix { }; + keymap_drawer = pkgs.python3Packages.callPackage ./draw { }; in { default = pkgs.mkShell { diff --git a/readme.md b/readme.md index 2de81ad..b6a3e70 100644 --- a/readme.md +++ b/readme.md @@ -31,7 +31,7 @@ compatible with Zephyr 3.0 is available - nix-based [local build environment](#local-development-workspace) -- simply `cd` into your workspace and start building without any setup -![](img/keymap.png) +![](draw/keymap.png) ## Timeless homerow mods @@ -359,6 +359,14 @@ pristine build can be triggered with `just build all -p`. (For this particular example, there is also a `just clean` recipe, which clears the build cache. To list all available recipes, type `just`.) +#### Drawing the keymap + +The build environment packages +[keymap-drawer](https://github.com/caksoylar/keymap-drawer). `just draw` parses +`base.keymap` and draws it to `draw/base.svg`. I haven't gotten around to +tweaking the output yet, so for now this is just a demonstration of how to set +things up. + #### Hacking the firmware To make changes to the ZMK source or any of the modules, simply edit the files