fix(tray-listener): 🐛 Fix tray icon click event handling and dynamic menu support in TrayListener

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-29 06:03:16 -07:00
parent 4515301dfc
commit 5d1d3dc63f

View file

@ -77,6 +77,7 @@ func _handle_command(msg: Dictionary) -> void:
if _gaze_controller != null:
_gaze_controller.toggle_mode()
var mode_name: String = _gaze_controller.get_mode_name()
FlightRecorder.record("vision.gaze_toggled", "Gaze mode changed", {"mode": mode_name})
_respond({"gaze_mode": mode_name})
"set_gaze_mode":
if _gaze_controller != null:
@ -137,6 +138,10 @@ func _handle_command(msg: Dictionary) -> void:
"open_settings":
EventBus.settings_opened.emit()
_respond({"settings_opened": true})
"open_settings_page":
var page: String = msg.get("page", "general")
EventBus.settings_open_requested.emit(page)
_respond({"settings_opened": true, "page": page})
"open_sound_settings":
EventBus.sound_settings_opened.emit()
"open_chat":
@ -156,6 +161,7 @@ func _handle_command(msg: Dictionary) -> void:
var enabled: bool = not AppState.get_companion("gaze_halo", false)
AppState.set_companion("gaze_halo", enabled)
EventBus.gaze_halo_toggled.emit(enabled)
FlightRecorder.record("vision.halo_toggled", "Gaze halo toggled", {"enabled": enabled})
_respond({"gaze_halo": enabled})
"toggle_mic":
var mic := _companion.get_node_or_null("Microphone")
@ -166,6 +172,7 @@ func _handle_command(msg: Dictionary) -> void:
_respond({"error": "Microphone not found"})
"camera_list":
var cameras: Array = msg.get("cameras", [])
FlightRecorder.record("vision.camera_list", "Camera list received from tray", {"count": cameras.size()})
EventBus.camera_list_updated.emit(cameras)
"state_get":
_handle_state_get(msg)
@ -251,6 +258,12 @@ func _handle_face(payload: Dictionary) -> void:
var prev := _last_attention
_last_attention = attention
FlightRecorder.record(
"vision.attention_changed",
"%s%s" % [prev, attention],
{"confidence": snappedf(confidence, 0.01)},
)
if attention == "absent" and prev != "absent":
EventBus.face_lost.emit()