isMetaPressed

Property

Common
expect val KeyEvent.isMetaPressed: Boolean

Indicates whether the Meta key is pressed.

Common
expect val PointerKeyboardModifiers.isMetaPressed: Boolean

true when the Meta key is pressed. This is commonly associated with the Windows or Command key on some keyboards.

Android
actual val KeyEvent.isMetaPressed: Boolean

Indicates whether the Meta key is pressed.

Android
actual val PointerKeyboardModifiers.isMetaPressed: Boolean

Code Examples

KeyEventIsMetaPressedSample

@Composable
fun KeyEventIsMetaPressedSample() {
    Box(
        Modifier.onKeyEvent {
                if (it.isMetaPressed && it.key == Key.A) {
                    println("Meta + A is pressed")
                    true
                } else {
                    false
                }
            }
            .focusable()
    )
}