| Crates.io | keyboard-layout-lib |
| lib.rs | keyboard-layout-lib |
| version | 0.1.0 |
| created_at | 2025-11-12 12:57:23.888974+00 |
| updated_at | 2025-11-12 12:57:23.888974+00 |
| description | Cross-platform keyboard layout utilities |
| homepage | |
| repository | https://github.com/ArielSklare/layout_lib |
| max_upload_size | |
| id | 1929234 |
| size | 59,711 |
Cross-platform keyboard layout utilities for:
cfg:
Add to your Cargo.toml:
layout_lib = { path = "../layout_lib" }
use layout_lib::*;
fn main() {
// Get highlighted text (platform-specific)
if let Some(text) = get_highlighted_text() {
println!("Selected: {text}");
}
// List layouts and get key maps
let layouts = list_layouts();
println!("Layouts: {:?}", layouts);
let maps = all_layout_vk_maps();
if let (Some(first), Some(second)) = (maps.get(0), maps.get(1)) {
// Infer layout for text and shift it
let text = "shalom";
let shifted = shift_text_language(text, first, second);
println!("Shifted: {shifted}");
}
}
xkbcommon (system library)wl-paste (Wayland), xclip/xsel (X11)wtype or xdotool for replacewindows crate COM/UI Automation and keyboard APIs. No extra setup.Re-exported at crate root:
// Selection
get_highlighted_text();
replace_highlighted_text(text);
// Layouts
list_layouts();
get_layout(index);
vk_to_char_map_default();
vk_to_char_map_for_layout(index_or_hkl);
all_layout_vk_maps();
// Shift utilities
get_text_leyaout_map(text, &maps);
shift_text_language(text, &from, &to);
// Types
KeyboardLayout; KeyboardDirection; LayoutMap;
MIT