2 releases

Uses new Rust 2024

0.0.2 Sep 22, 2025
0.0.1 Sep 22, 2025

#550 in Hardware support

MIT license

47KB
1K SLoC

mac-keycode: Virtual keycodes and specs for macOS.

  • Key: Enum of all macOS virtual keycodes (generated at build time).
  • Modifier: Enum of modifier keys with conversions to/from Key.
  • Spec helpers: Key::from_spec, Key::to_spec, and Modifier::from_spec, Modifier::to_spec.

The Key enum is generated from the macOS SDK HIToolbox header and assigned the exact hardware codes. Variant names are normalized (ANSI_ stripped; digits prefixed with Digit). Values are hex and the enum is repr(u16).


mac-keycode

mac-keycode is a small, macOS-only library that exposes the system’s virtual keyboard keys and modifiers in a convenient, type-safe way. It provides a generated enum of all keys, a simple way to convert to and from human-friendly “spec” strings (including common aliases), and helpers for working with modifier keys. The key set is derived from the macOS SDK so values stay faithful to the platform.

See the crate documentation for full details and examples.

Dependencies

~0.3–0.9MB
~19K SLoC