plus

open operator fun plus(other: Shortcut): Shortcut

This operator function enables the concatenation with a Shortcut:

Keys.Alt + Shortcut("K")

See also


open operator fun plus(other: String): Shortcut

This operator function enables the concatenation with simply a String to enable a nice readable keyboard combination:

Keys.Shift + "F"

Be aware that the Shortcut.key property is case sensitive just likte the KeyboardEvent.key property. So in order to match a shortcut with a capital key of an event, you must the Shortcut.shift flag to true.

// A capital "K" should be matched, but would fail here:
keydowns.map { shortcutOf(it) == Shortcut("K") } // would emit `false`!
// Instead this will work:
keydowns.map { shortcutOf(it) == Shortcut("K", shift = true) }
// or with this operator an better readbility:
keydowns.map { shortcutOf(it) == Keys.Shift + "K" }

See also