Skip to content

Fix macOS tray toggle and Space switching#373

Merged
kdroidFilter merged 2 commits intomasterfrom
fix/macos-tray-toggle-and-spaces
Feb 8, 2026
Merged

Fix macOS tray toggle and Space switching#373
kdroidFilter merged 2 commits intomasterfrom
fix/macos-tray-toggle-and-spaces

Conversation

@kdroidFilter
Copy link
Owner

@kdroidFilter kdroidFilter commented Feb 8, 2026

Summary

  • Fix primary action not hiding the tray window when it's the only window (accessory mode)
  • Add macOS Space detection and window migration via native NSApp.windows iteration (fallback for Native.getComponentID returning 0 on Compose DialogWindow)
  • Suppress focus-loss auto-hide during Space switches to prevent race conditions
  • Reduce toggle/show/hide delays for snappier responsiveness

Changes

  • MacOsWindowManager.kt: Add isFloatingWindowOnActiveSpace(), bringFloatingWindowToFront(), applySpaceBehavior() methods using NSApp.windows fallback
  • TrayApp.kt: Use AtomicLong for thread-safe timestamps, Space-aware primary action logic, focus listener suppression on Space switch, reduced timing constants

Test plan

  • Toggle show/hide with tray-only (no other windows)
  • Toggle show/hide with another window present
  • Show popup on Space 1, switch to Space 2, click tray → popup moves to Space 2
  • Verify no flickering or double-click issues with reduced delays
  • Verify outside-click dismiss still works

- Fix primary action not hiding the tray window in accessory mode (no other windows)
- Add Space detection via NSApp.windows iteration (Native.getComponentID returns 0 for Compose DialogWindow)
- Move window to active Space via bringFloatingWindowToFront() instead of auto-following
- Suppress focus-loss auto-hide on Space switch to prevent race condition
- Use AtomicLong for thread-safe cross-thread timestamp communication
- Reduce toggle/show/hide delays for snappier responsiveness
@kdroidFilter kdroidFilter merged commit 0b8e842 into master Feb 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant