LavaUI docs

struct KeyShortcut

Swift

struct KeyShortcut

Keyboard shortcut attached to a menu item.

Use KeyShortcut(KeyCode.s, .primary) for the platform save chord. Matching against live key events uses matches(key:mods:) with the same GLFW numbering as InputEvent.

Sources/LavaMenu/Menu.swift:78

Constructors

init(_ key: Int32, _ modifiers: KeyShortcutModifier = [])

Not documented.

Sources/LavaMenu/Menu.swift:82

init(_ key: Int32, _ modifiers: KeyShortcutModifier...)

Not documented.

Sources/LavaMenu/Menu.swift:87

Properties

var key: Int32

Not documented.

Sources/LavaMenu/Menu.swift:79

var modifiers: KeyShortcutModifier

Not documented.

Sources/LavaMenu/Menu.swift:80

static var platformPrimaryMod: Int32 { get }

Platform primary modifier bit (Super/Cmd on macOS, Control elsewhere). Values match GLFW / LavaUI KeyMods.

Sources/LavaMenu/Menu.swift:96

Methods

func matches(key: Int32, mods: Int32, primary: Int32 = KeyShortcut.platformPrimaryMod) -> Bool

Whether a physical key event matches this shortcut exactly on the mod bits.

Sources/LavaMenu/Menu.swift:116

func resolvedMods(primary: Int32 = KeyShortcut.platformPrimaryMod) -> Int32

GLFW-style mod bitfield for this shortcut.

Sources/LavaMenu/Menu.swift:105