# Focus change events for KMM

**URL:** <https://discuss.kotlinlang.org/t/focus-change-events-for-kmm/28927>\
**Category:** Uncategorized\
**Created:** [July 20, 2024, 5:43am UTC](https://discuss.kotlinlang.org/t/focus-change-events-for-kmm/28927 "2024-07-20T05:43:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kqvanity](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@kqvanity](https://discuss.kotlinlang.org/u/kqvanity)\
**Post date:** [July 20, 2024, 5:43am UTC](https://discuss.kotlinlang.org/t/focus-change-events-for-kmm/28927/1 "2024-07-20T05:43:08Z")

</div>

I’m developing an app which has a single window on Desktop. I’m trying to detect focus change events for that particular window. For example when I hover my mouse away from it, or the window loses focus.  
I’ve tried using `onFocusEvent` and `onFocusChanged` but they only get invoked when I set the `Window` visible parameter to `true`

```kotlin
fun main() {
   application {
     window () {
      Column (
         modifier = Modifier
           .onFocusEvent { 
              // Only gets invoked when the window becomes visible
            }
            .onFocusChanged {
              // Same goes here as well
            }
        ) {
       }
     }
  }
}

```
