CLI tool to generate preview images from a zmk .keymap file

ZMK viewer

GitHub go.mod Go version Vuln golangci-lint

A work in progress Cli tool to generate preview images from a zmk .keymap file.

Installation

You can download a pre compiled binary directly from the releases for your OS/Architecture.

Linux/MacOS

I made an installation script that should download the latest available version corresponding to your OS and architecture. sudo is needed to copy the binary to /usr/local/bin

curl -sL https://raw.githubusercontent.com/MrMarble/zmk-viewer/master/scripts/install.sh | sudo -E bash -
# or with wget
wget -O - https://raw.githubusercontent.com/MrMarble/zmk-viewer/master/scripts/install.sh | sudo -E bash -

Windows

Download the executable directly from the releases

Others

If you already have Go in your system you can use go install to build the binary without cloning the repo first.

go install github.com/mrmarble/zmk-viewer/cmd/zmk-viewer@latest # or target a specific version @v0.1.0

Usage

Usage: zmk-viewer generate <keyboard-name>

Generate layout image.

Arguments:
  <keyboard-name>    Keyboard name to fetch layout.

Flags:
  -h, --help           Show context-sensitive help.
  -D, --debug          Enable debug mode
      --version        Print version information and quit

  -f, --file=STRING    ZMK .keymap file
  -t, --transparent    Use a transparent background.
  -o, --output="."     Output directory.

Keyboard name should be the same as in https://config.qmk.fm.

zmk-viewer generate cradio

Will output this image:

You can pass a .keymap file (this one for reference) to generate the layout with bindings

zmk-viewer generate -f ~/zmk-config/config/cradio.keymap cradio

will output an image for each layer:

Owner
Alvaro Tinoco
Full Stack Web Developer
Alvaro Tinoco
Similar Resources

Get and save EroCool.com images

Get and save EroCool.com images

Nov 9, 2021

Eightbit - A converter to create shitty 8-bit like images

eightbit A converter to create shitty 8-bit like images. Usage To install: go in

Jan 8, 2022

Packer Plugin Vagrant - The Vagrant multi-component plugin can be used with HashiCorp Packer to create custom images

Packer Plugin Vagrant - The Vagrant multi-component plugin can be used with HashiCorp Packer to create custom images

Jul 13, 2022

Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading.

Knit Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading. Example openapi: "

Sep 15, 2022

[TOOL, CLI] - Filter and examine Go type structures, interfaces and their transitive dependencies and relationships. Export structural types as TypeScript value object or bare type representations.

typex Examine Go types and their transitive dependencies. Export results as TypeScript value objects (or types) declaration. Installation go get -u gi

Dec 6, 2022

HTTP service to generate PDF from Json requests

pdfgen HTTP service to generate PDF from Json requests Install and run The recommended method is to use the docker container by mounting your template

Dec 2, 2022

Automatically generate Go test boilerplate from your source code.

Automatically generate Go test boilerplate from your source code.

gotests gotests makes writing Go tests easy. It's a Golang commandline tool that generates table driven tests based on its target source files' functi

Jan 3, 2023

generate fake data in go

Faker for Go Usage package main import ( "github.com/manveru/faker" ) func main() { fake, err := faker.New("en") if err != nil { panic(err

Sep 29, 2022

:runner:runs go generate recursively on a specified path or environment variable and can filter by regex

Package generate Package generate runs go generate recursively on a specified path or environment variable like $GOPATH and can filter by regex Why wo

Sep 27, 2022
Comments
  • Generation failed for keyboard splitkb/kyria/rev2

    Generation failed for keyboard splitkb/kyria/rev2

    Thank you for creating this tool. Two issues I've noticed trying to use it with the Kyria v2:

    1. The tool will complain about the output path not existing because of the path separators in the name of the output file. This can be remedied by creating the parent directory prior to running the tool. Ideally, this folder could be created as part of the execution of the tool.
    2. The output png is just one long row of 1u keys shapes rev2 .

    Reproduction command (using version 1.1.0 on a Mac):

    % mkdir -p splitkb/kyria
    % ./zmk-viewer generate "splitkb/kyria/rev2" -D
    2022-05-07T17:04:08-05:00 DBG  name=splitkb/kyria/rev2
    2022-05-07T17:04:08-05:00 INF Fetching keyboard layout.
    2022-05-07T17:04:08-05:00 DBG  url=https://keyboards.qmk.fm/v1/keyboards/splitkb/kyria/rev2/info.json
    2022-05-07T17:04:09-05:00 DBG  Image Height=262 Image Width=747 Max X=16.5 Max Y=5.25
    2022-05-07T17:04:09-05:00 DBG  Image Height=70 Image Width=2255 Max X=50 Max Y=1
    2022-05-07T17:04:09-05:00 INF Image saved Path=/Users/bmtran/Downloads/zmk-viewer-1.1.0-darwin-arm64/splitkb/kyria/rev2.png
    
  • Add sensor-bindings support, also optional fields

    Add sensor-bindings support, also optional fields

    Summary

    • added sensor-bindings to the Layer struct
      • moved the EndBrace to a separate field since sensor-bindings is optional
    • make the Configs field optional
    • make the Combos field optional
    • add a test for the default sofle/keyhive keymap

    tl;dr I tried to run on the default sofle/keyhive keymap, and it threw up because it didn't have &mt, combos within the keymap block, and included sensor-bindings in the layers. So I added logic to handle each of those, since they all seem to be optional for a functional keymap file.

    In checking for those, I saw there are a few more fields that are optional that could get added later, but I've only handled for the ones I've run into and can test.

    Thanks for the library!

  • Add support to templates

    Add support to templates

    I've created a template system to support custom keyboard layouts that are not available in QMK Toolbox as suggested in #2.

    The template uses YAML syntax and is quite simple with a few keywords available, it can be improved with some feedback.

    This is an example template for S'mores Clog keyboard:

    keyboard:
      name: The Clog # Optinal, currently not used
      mirror: true # To create a split keyboard declaring only the first half
      columns:
        - keys: 1 # Number of keys in the column
          step: 3 # Offset from top
        - keys: 2
          step: 2.5
        - keys: 3
          step: 0.5
        - keys: 3
        - keys: 3
          step: 0.5
        - keys: 4
          step: 0.5
      keys: # To target specific keys that need more personalization. 
        - column: 6 # Thumb key
          row: 2
          step: 0.9
          h: 1.7 # Height of the key. there's also 'w' wor width
    

    When running the command zmk-viewer generate clog --template theClog.yaml this is the image produced: imagen

    It's also possible to use the template to parse .keymap files using this syntax: zmk-viewer generate clog --template theClog.yaml -f clog.keymap: imagen


    Currently, the template is generated from left to right & top to bottom while the keymap is parsed top to bottom & left to right. This generates some inconsistencies in weird layouts when the keys are formatted to look like the keyboard, like in The Clog:

            MAIN_layer {
                bindings = <
                                &kp W      &kp E       &kp R        &kp T            &kp Y     &kp U      &kp I           &kp O
              &kp Q &kp A       &kp S      &kp D       &lt SYM F    &kp G            &kp H     &lt SYM J  &kp K           &kp L        &kp SQT        &kp P
                    &mt LSHFT Z &mt LALT X &mt LCTRL C &mt LGUI V   &kp B            &kp N     &mt RGUI M &mt RCTRL COMMA &mt RALT DOT &mt RSHFT FSLH
                                                       &lt BT ENTER &lt NAV SPACE    &sk RSHFT &kp BSPC
                >;
            };
    

    I'm not sure about how ZMK parses .keymap files, if they take in account this order or not.

  • adding keyboards that aren't available at qmk configurator?

    adding keyboards that aren't available at qmk configurator?

    Is it possible to add support for keyboards that aren't currently available on the qmk configurator, e.g. smores' clog (https://www.smoresboards.com/product/clog https://github.com/smores56/zmk-config-clog)?

Instant online preview of HTML files or websites.

Instant online preview of HTML files or websites.

Apr 19, 2022
Work with remote images registries - retrieving information, images, signing content

skopeo skopeo is a command line utility that performs various operations on container images and image repositories. skopeo does not require the user

Jan 5, 2023
A tool that facilitates building OCI images
A tool that facilitates building OCI images

Buildah - a tool that facilitates building Open Container Initiative (OCI) container images The Buildah package provides a command line tool that can

Jan 3, 2023
gal - generate authors file from git log

[日本語] gal - generate authors file from git log gal command generate AUTHORS.md file at current directory. gal command gets the author name and email a

Aug 19, 2022
Simple Golang API to demonstrate file upload to fireabase storage and retrieving url of uploaded file.

go-firebase-storage -Work in progress ??️ Simple Golang API that uses Firebase as its backend to demonstrate various firebase services using Go such a

Oct 4, 2021
Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file

About hclmergetool Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file Installation Binary Rel

Feb 6, 2022
A command line tool to generate sequence diagrams
A command line tool to generate sequence diagrams

goseq - text based sequence diagrams A small command line utility used to generate UML sequence diagrams from a text-base definition file. Inspired by

Dec 22, 2022
A tool to generate Pulumi Package schemas from Go type definitions

MkSchema A tool to generate Pulumi Package schemas from Go type definitions. This tool translates annotated Go files into Pulumi component schema meta

Sep 1, 2022
A reverse-proxy cache for external images used on LinuxFr.org

External images on LinuxFr.org Our users can use images from external domains on LinuxFr.org. This component is a reverse-proxy / cache for these imag

May 14, 2021
A minimalist Go PDF writer in 1982 lines. Draws text, images and shapes. Helps understand the PDF format. Used in production for reports.
A minimalist Go PDF writer in 1982 lines. Draws text, images and shapes. Helps understand the PDF format. Used in production for reports.

one-file-pdf - A minimalist PDF generator in <2K lines and 1 file The main idea behind this project was: "How small can I make a PDF generator for it

Dec 11, 2022