Just for fun: Is there a way to detect and react t...
# compose-desktop
a
Just for fun: Is there a way to detect and react to key presses outside the focus (or when minimized).
j
Compose can react to any state change in your app, so this question really just boils down to "can I detect key presses outside a window with Java". Java's default APIs don't allow this AFAIK, but with some JNI it should be possible. However, that's way outside the scope of this slack channel.
a
Ya thanks, I was just asking this for fun :)
s
I was able to do this years ago with a java library. It used JNI I believe. I looked, but can’t find it, but I found it at the time with Google searches. Maybe there is something better now 🙂
a
I'll try to build my own in Kotlin/Multiplatform for Windows+Linux and probably JVM too 😃
s
Be sure to post it on Github 🙂
👍 1
a
@spierce7 its here if you'd like to check out, will work on it slowly for other platforms as I go. Love to hear feedback :)