Ashet OS

struct: ashet.KeyboardEvent

Fields

event_type: SharedEventType
usage: KeyUsageCode

The raw usage code for the key. Meaning depends on the layout; kinda represents the physical position on the keyboard.

text: ?str

If set, the pressed key combination has a mapping in the current keyboard layout that produces text input.

Note:

This doesn't necessarily contains printable codes, but can also contain combining characters like U+0301 (Combining Acute Accent).

Note:

This isn't a true *composed* text input and cannot be directly used in a text field or such. This is primarily meant to be passed into an input method editor.

Lore:

This field isn't a perfect solution, but it's good enough for what we're trying to achieve: International text input. The idea of using combining characters for dead keys allows the IME to actually compose a sequence of U+0301 (Combining Acute Accent), U+0041 (Latin Capital Letter A) to be composed into U+00C1 (Latin Capital Letter A With Acute) instead of emitting two codepoints.

This method is flexible enough to be future proof and expansible.

pressed: bool

The key in this event was pressed or released

modifiers: KeyboardModifiers

The modifier keys currently active