How can I listen to whether a `Window` is active/f...
# compose-desktop
m
How can I listen to whether a
Window
is active/focused as Compose state? The
window.isActive
property is accessible but I'm looking for a way to listen for changes in it.
a
You can use the AWT/Swing APIs:
Copy code
window.addWindowListener(object: WindowAdapter() {
    override fun windowActivated(evt: WindowEvent?) { 
        ...
    }
})
thank you color 1
m
Actually, I found it's exposed in the Compose world through
LocalWindowInfo
, so no need to use the AWT APIs.
a
Yes, that’s better
Although I’m not sure of the difference between “focused” and “active”.