8 releases (5 breaking)
| 0.5.0 | Oct 11, 2025 |
|---|---|
| 0.4.1 | Sep 29, 2025 |
| 0.3.0 | Sep 21, 2025 |
| 0.2.1 | Mar 22, 2025 |
| 0.0.1 | Apr 2, 2024 |
#295 in Hardware support
191 downloads per month
63KB
1.5K
SLoC
qmk-via-api
qmk-via-api provides an implementation of the VIA API for QMK (Quantum Mechanical Keyboard) based keyboards. It allows developers to interact with QMK keyboards programmatically, enabling tasks such as configuring keymaps, macros, lighting effects and more.
Additionally, this library includes Python bindings for all API calls for integration of QMK keyboard configuration into Python-based applications or scripts.
Usage
Rust
Add dependency with Cargo:
cargo add qmk-via-api
Usage example:
use qmk_via_api::{api::KeyboardApi, scan::scan_keyboards};
fn main() {
if let Some(dev) = scan_keyboards().first() {
let api = KeyboardApi::new(dev.vendor_id, dev.product_id, dev.usage_page).unwrap();
println!("Protocol version: {:?}", api.get_protocol_version());
println!("Layer count: {:?}", api.get_layer_count());
} else {
println!("No devices found");
}
}
Disable Python Bindings
The python feature flag is enabled by default. In projects that don't interoperate with Python, the Python bindings can be disabled by turning off default features. In Cargo.toml:
[dependencies]
qmk-via-api = { version = "0.3.0", default-features = false }
Python
Install with pip:
pip install qmk-via-api
Usage example:
import qmk_via_api
from qmk_via_api import scan_keyboards
devices = scan_keyboards()
if devices:
dev = devices[0]
api = qmk_via_api.KeyboardApi(dev.vendor_id, dev.product_id, dev.usage_page)
print(f"Protocol version {api.get_protocol_version()}")
print(f"Layers count: {api.get_layer_count()}")
else:
print("No devices found")
License & Attribution
Parts of this project are based on code from the VIA project, which is licensed under the GNU General Public License v3.0.
Dependencies
~1–13MB
~103K SLoC