Skip to content

Commit e74b26b

Browse files
committed
Add macOS-specific delay before polling in TrayApp for improved dialog positioning reliability
1 parent 6f63d1c commit e74b26b

File tree

1 file changed

+6
-1
lines changed
  • src/commonMain/kotlin/com/kdroid/composetray/tray/api

1 file changed

+6
-1
lines changed

src/commonMain/kotlin/com/kdroid/composetray/tray/api/TrayApp.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,15 @@ fun ApplicationScope.TrayApp(
391391
}
392392

393393
// FIX: Consolidated visibility handling with position calculation BEFORE showing the window.
394-
// Added polling loop to wait for a valid (non-default) position.
394+
// Added macOS-specific delay before polling, as per your feedback.
395395
LaunchedEffect(isVisible) {
396396
if (isVisible) {
397397
if (!shouldShowWindow) {
398+
// macOS-specific delay to allow tray icon to settle
399+
if (os == MACOS) {
400+
delay(300)
401+
}
402+
398403
val widthPx = currentWindowSize.width.value.toInt()
399404
val heightPx = currentWindowSize.height.value.toInt()
400405
var position: WindowPosition = WindowPosition.PlatformDefault

0 commit comments

Comments
 (0)