Is there a way to get an arbitrary key's key_state?

Basically as the title says. It seems like there should be a way, but I wasn’t able to find one.

There’s no hardware-agnostic way at the moment… you can look at the right bits of KeyboardHardware.leftHandState.all and KeyboardHardware.previousLeftHandState.all (and similarly for the right hand), and figure out the keystate from there. This does not account for injected keys, mind you.

If you are only interested in whether the key is pressed or not (and not whether they toggled on or off), you can use KeyboardHardware.isKeyswitchPressed(row, col). This felt sufficiently low-level to leave it at KeyboardHardware, without a higher level wrapper around it.

1 Like