Skip to content

Commit

Permalink
improve layout rendering script
Browse files Browse the repository at this point in the history
  • Loading branch information
burkfers committed Mar 30, 2024
1 parent c0776f5 commit 85e7b35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion assets/pics/layouts/render_full_boards.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash

#keymap draw cnano.yaml > cnano.svg && convert -size 800x800 -background '#303030' cnano.svg cnano.png && feh cnano.png
ensure_exists_in_path() {
type $1 >/dev/null 2>&1 || { echo >&2 "Could not find $1 in path. Aborting."; exit 1; }
}

ensure_exists_in_path keymap
ensure_exists_in_path convert

for board in cnano cmini charybdis skeletyl tbkmini scylla; do
echo $board
Expand Down
12 changes: 11 additions & 1 deletion assets/pics/layouts/render_single_layers.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#/bin/bash

ensure_exists_in_path() {
type $1 >/dev/null 2>&1 || { echo >&2 "Could not find $1 in path. Aborting."; exit 1; }
}

ensure_exists_in_path yq
ensure_exists_in_path tr
ensure_exists_in_path keymap
ensure_exists_in_path convert

for board in cnano cmini charybdis skeletyl tbkmini scylla; do
echo $board
rm -r $board
mkdir -p $board
for layer in `yq '.layers | keys[]' $board.yaml | tr -d '"'`; do # parse layer list from yaml, remove quotes
echo $board/$layer

layer_safe=${layer//\//_} # replace slash with underscore

mkdir -p $board
keymap draw -s "$layer" -- $board.yaml > $board/$layer_safe.svg
convert -size 800x800 -background '#303030' "$board/$layer_safe.svg" "$board/$layer_safe.png"
done
Expand Down

0 comments on commit 85e7b35

Please sign in to comment.