Improve tray manager handling, particularly on macOS #1825

* On shutdown, message tray manager before lengthy project shutdown
* When dead ports are found, explicitly update the menu
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-08-08 22:17:29 +02:00
1 parent 9f9700a503
commit 430fc62e72
3 files changed
+12 -6

No files matched your search

+6 -2
View File
@@ -116,8 +116,12 @@ Status of the `main` branch. Changes prior to the next official version change w
* Dashboard:
- Fix: Serena PyPI version check triggered by callback on main thread could delay agent startup #1774
- Fix: on macOS, the `tray_manager` interface put an icon in the Dock and in the app switcher
(should only use menu bar icon)
- Improvements in `tray_manager` interface mode:
- Fix: on macOS, the `tray_manager` interface put an icon in the Dock and in the app switcher
(should only use menu bar icon)
- On Serena shutdown, message the tray manager before lengthy project shutdowns
- Fix: When dead ports are detected (Serena instance gone), explicitly update the tray menu
immediately (may not update automatically)
- Use `tray_manager` interface as new default on macOS
* Hooks:
+5 -4
View File
@@ -1472,10 +1472,7 @@ class SerenaAgent:
Shutdown handler of the agent, freeing resources and stopping background tasks.
"""
log.info("SerenaAgent is shutting down ...")
if self._active_project is not None:
log.info(f"Shutting down active project '{self._active_project.project_name}' ...")
self._active_project.shutdown(timeout=timeout)
self._active_project = None
# apply shutdown depending on allocated resources, handling quick ones first (dashboard manager & GUI viewer)
if self._gui_log_viewer:
log.info("Stopping the GUI log window ...")
self._gui_log_viewer.stop()
@@ -1483,6 +1480,10 @@ class SerenaAgent:
if self._dashboard_manager:
self._dashboard_manager.shutdown()
self._dashboard_manager = None
if self._active_project is not None:
log.info(f"Shutting down active project '{self._active_project.project_name}' ...")
self._active_project.shutdown(timeout=timeout)
self._active_project = None
def shutdown(self) -> None:
"""
+1
View File
@@ -1155,6 +1155,7 @@ class SerenaDashboardTrayManager:
for port in dead_ports:
self._instances.pop(port, None)
log.info("Removed unreachable instance on port %d", port)
self._update_menu()
# terminate if no instances remain
with self._lock: