Fix Windows tray icon callbacks failing due to thread safety issues#6
Fix Windows tray icon callbacks failing due to thread safety issues#6Copilot wants to merge 8 commits into
Conversation
- Pass tkinter_root to Windows tray implementation - Schedule all callbacks on main Tkinter thread using root.after() - Fixes issue where quit and show window didn't work from tray menu - Ensures thread-safe UI updates from tray icon events Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
- Extract common pattern into _schedule_callback helper method - Improves code maintainability and readability Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
|
@copilot I dont like passing the tkinter root in, should the callbacks just all pass in wrapped in tkinter after, ensure all tray implementations would work correctly with that setup |
… tray implementations - Remove tkinter_root parameter from TrayIcon and WindowsTrayImpl - Wrap all callbacks with lambda: root.after(0, callback) in MainWindow._setup_tray() - This keeps tray implementations simpler and platform-agnostic - Thread safety is now handled at the callback registration point Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
Done! I've refactored the solution to wrap callbacks with The callbacks are now wrapped in on_show=lambda: self.root.after(0, self._show_window),
on_quit=lambda: self.root.after(0, self.quit_app),
# etc.This approach ensures thread safety while maintaining clean separation of concerns. Commit: 9eeba2e |
|
@copilot can we simplify the macos tray now that callbacks are always on the main loop |
…alling - Remove performSelectorOnMainThread calls since callbacks are already wrapped with root.after() - Call setupStatusBar and updateMonitorMenuTitle_ directly - already on main thread via async_mainloop - Reduce setup delay from 0.3s to 0.1s - Update documentation to reflect simplified implementation Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
Co-authored-by: bryfur <7673964+bryfur@users.noreply.github.com>
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.