kbd-iced 0.1.0

iced bridge for kbd — converts iced key events and modifiers to kbd types.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented4 out of 7 items with examples
  • Size
  • Source code size: 151.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.82 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 34s Average build duration of successful builds.
  • all releases: 34s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • joshuadavidthomas/kbd
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • joshuadavidthomas

kbd-iced

crates.io docs.rs

kbd bridge for iced — converts key events and modifiers to kbd types.

This lets GUI key events (from iced) and global hotkey events (from kbd-global) feed into the same Dispatcher. Useful in iced apps that want both in-window shortcuts and system-wide hotkeys handled through a single hotkey registry.

Iced defines its own W3C-derived key types: key::Code for physical key positions and key::Physical wrapping Code with an unidentified fallback. This crate only converts physical keys — they are layout-independent and match kbd's model.

[dependencies]
kbd = "0.1"
kbd-iced = "0.1"

Extension traits

  • IcedKeyExt — converts an iced key::Code or key::Physical to a kbd::Key
  • IcedModifiersExt — converts iced Modifiers to a Vec<Modifier>
  • IcedEventExt — converts an iced keyboard Event to a kbd::Hotkey

Usage

use iced_core::keyboard::{key::Code, Modifiers};
use kbd::prelude::*;
use kbd_iced::{IcedKeyExt, IcedModifiersExt};

let key = Code::KeyA.to_key();
assert_eq!(key, Some(Key::A));

let mods = Modifiers::CTRL.to_modifiers();
assert_eq!(mods, vec![Modifier::Ctrl]);

Key mapping

iced kbd Notes
Code::KeyACode::KeyZ Key::AKey::Z Letters
Code::Digit0Code::Digit9 Key::DIGIT0Key::DIGIT9 Digits
Code::F1Code::F35 Key::F1Key::F35 Function keys
Code::Numpad0Code::Numpad9 Key::NUMPAD0Key::NUMPAD9 Numpad
Code::Enter, Code::Escape, … Key::ENTER, Key::ESCAPE, … Navigation / editing
Code::ControlLeft, … Key::CONTROL_LEFT, … Modifier keys as triggers
Code::SuperLeft / Code::Meta Key::META_LEFT iced's Super = kbd's Meta
Code::MediaPlayPause, … Key::MEDIA_PLAY_PAUSE, … Media keys
Code::BrowserBack, … Key::BROWSER_BACK, … Browser keys
Physical::Unidentified(_) None No mapping possible

Modifier mapping

iced kbd
CTRL Modifier::Ctrl
SHIFT Modifier::Shift
ALT Modifier::Alt
LOGO Modifier::Super

License

kbd-iced is licensed under the MIT license. See the LICENSE file for more information.