Skip to content

Commit d9aa1a1

Browse files
Update WaitForTrayReady for cross-platform support
Modified WaitForTrayReady to handle both Linux (AppIndicator) and macOS (AppKit) tray icon readiness. Updated comments to clarify platform-specific event processing and ensure tray icon visibility before screenshots.
1 parent ad2f6f0 commit d9aa1a1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/unit/test_tray.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ class TrayTest: public BaseTest {
130130
trayRunning = false;
131131
}
132132

133-
// Process pending GTK events to allow AppIndicator to register
133+
// Process pending events to allow tray icon to appear
134134
// Call this ONLY before screenshots to ensure the icon is visible
135135
void WaitForTrayReady() {
136-
#if defined(TRAY_APPINDICATOR)
137-
// On Linux with AppIndicator, process GTK events to allow D-Bus registration
138-
// This ensures the icon actually appears in the system tray before screenshots
139-
// Use shorter iterations to avoid interfering with event loop state
136+
#if defined(TRAY_APPINDICATOR) || defined(TRAY_APPKIT)
137+
// On Linux: process GTK events to allow AppIndicator D-Bus registration
138+
// On macOS: give the status item time to appear in the menu bar
139+
// Both use non-blocking event processing with delays (500ms total)
140140
for (int i = 0; i < 100; i++) {
141141
tray_loop(0); // Non-blocking - process pending events
142142
std::this_thread::sleep_for(std::chrono::milliseconds(5));

0 commit comments

Comments
 (0)