Skip to content
/ kbdgen Public

The next iteration of a Rust keyboard layout generator

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

divvun/kbdgen

Repository files navigation

kbdgen

A tool to build keyboard packages for a multitude of platforms using a single, simple text file definition. Supported outputs:

  • Linux (X11, m17n)
  • macOS
  • Windows
  • ChromeOS
  • iOS/iPadOS
  • Android
  • SVG
  • hit-error correction model as an FST, to be used with our spellers
  • CLDR keyboard definitions is presently missing, but is in the pipeline

We think it's pretty cool. Documentation (under construction -- how to update).

Runtime dependency

kbdgen uses convert which is part of imagemagick

For Mac: brew install imagemagick For Linux: <pkg-manager> install imagemagick

Installation

  1. get Rust
  2. clone this repo: git clone https://github.com/divvun/kbdgen.git
  3. cd kbdgen
  4. cargo install --path . (this installs kbdgen to the path)

Alternatively - download a precompiled binary from nightly builds:

Extract the archive, and move the binary to somewhere on your $PATH.

Example Usage

cargo run -- target --bundle-path C:\Projects\Divvun\keyboards\keyboard-sme\sme.kbdgen --output-path C:\KbdgenBuilds\sme_mac macos generate

Let's build an android app. There's two. divvun-dev-keyboard and divvun-keyboard. The former is the unstable one where we do all the testing. The latter one gets pushed to production. Both are deployed as separate apps in google playstore.

Alas, I digress.

We want to build divvun-dev-keyboard. Clone divvun-dev-keyboard.

cd source/divvun
git clone [email protected]:divvun/divvun-dev-keyboard.git
cd ../kbdgen
cargo run -- fetch -b /Users/srdkvr/source/divvun/divvun-dev-keyboard/divvun-dev.kbdgen #fetches deps
cargo run -- target --bundle-path /Users/srdkvr/source/divvun/divvun-dev-keyboard/divvun-dev.kbdgen --output-path ~/source/divvun/android_keyboard android build

Note - you will need imagemagick to run converting of images - so

$ brew install imagemagick@6
$ echo 'export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

Your typical commands are

  • ... android clone # Clones the base android repository
  • ... android generate # Generates all the layouts and speller configs, but doesn't clone stuff
  • ... android build # Both of the above.

TL;DR Android

Your

For Android run two commands:

kbdgen target --bundle-path C:\Projects\Divvun\keyboards\keyboard-sme\sme.kbdgen --output-path C:\KbdgenBuilds\sme_android android clone
kbdgen target --bundle-path C:\Projects\Divvun\keyboards\keyboard-sme\sme.kbdgen --output-path C:\KbdgenBuilds\sme_android android generate

License

This project is licensed under either of

at your option.

Contribution

Fork and PR on Github.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.