#analysis #keyboard #optimization

keynergy

An efficient and extensible layout analysis library

4 releases

0.2.7 Oct 23, 2022
0.2.6 Jul 20, 2022
0.2.5 May 9, 2022
0.2.4 Apr 7, 2022

#1392 in Hardware support

Download history 7/week @ 2024-02-26 72/week @ 2024-04-01

72 downloads per month

GPL-3.0-or-later

5MB
808 lines

keynergy

This is the core library of the Keynergy project. It includes functionality for loading, modifying, and analyzing layouts.

It is used as the basis for KLCord, layoutexport, as well as CLI and GUI analysis applications that are in development.

Usage

It's not recommended to use this library yet, as it has not reached release 1.0.0. Because of this, there will be frequent breaking changes in order for development to be as fast as possible. 1.0.0 probably won't be released until the official CLI application is released.

Contributing

This library is a small project, but the code is likely not written very idiomatically. If you're at all experienced with Rust, feel free to look around at the code and change anything you think could be improved. Any contributions are appreciated - even documentation additions or comments are extremely helpful.


lib.rs:

Keynergy

Keynergy is a powerful, efficient, and extensible library for keyboard layout analysis.

Features

Keynergy allows you to:

  • serialize and deserialize layouts, keyboards, metrics, text data, and more using Serde
  • get the frequencies of characters, bigrams, trigrams, and skipgrams in a text
  • declaratively write custom metrics using Ketos
  • prebake almost all analysis data before the layout is even known, making Keynergy extremely efficient

Example

use keynergy::{Keyboard, Layout, Keys, Direction, Pos};

let mut qwerty = Keys::qwerty();
assert_eq!(qwerty.pos_key(Pos::new(0, 0)), Some(&'q'));
assert_eq!(qwerty.pos_key(Pos::new(0, 1)), Some(&'a'));

// Easily swap keys.
qwerty.swap(Pos::new(0,0), Pos::new(0, 1));
assert_eq!(qwerty.pos_key(Pos::new(0,0)), Some(&'a'));

// Provides constants for our 10 human fingers.
use keynergy::fingers::*;

// Get the direction between two fingers.
assert_eq!(Direction::from(LI, LM), Direction::Outward);
assert_eq!(Direction::from(LM, LI), Direction::Inward);
assert_eq!(Direction::from(LI, LI), Direction::None);
assert_eq!(Direction::from(LI, RM), Direction::None);

// Can also be written this way.
assert_eq!(LI.dir_to(LM), Direction::Outward);

Dependencies