Implement tray close-desktop action
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

This commit is contained in:
Virgil 2026-04-02 19:03:11 +00:00
parent 4f03fc4c64
commit 483c408497
2 changed files with 16 additions and 1 deletions

View file

@ -946,7 +946,14 @@ func (s *Service) handleTrayAction(actionID string) {
_, _, _ = s.Core().PERFORM(window.TaskFocus{Name: info.Name})
}
case "close-desktop":
// Hide all windows — future: add TaskHideWindow
// Hide all tracked windows using the existing visibility task.
infos := s.ListWindowInfos()
for _, info := range infos {
_, _, _ = s.Core().PERFORM(window.TaskSetVisibility{
Name: info.Name,
Visible: false,
})
}
case "env-info":
// Query environment info via IPC and show as dialog
result, handled, _ := s.Core().QUERY(environment.QueryInfo{})

View file

@ -1049,6 +1049,14 @@ func TestHandleWSMessage_Extended_Good(t *testing.T) {
assert.True(t, handled)
})
t.Run("tray close desktop", func(t *testing.T) {
svc.handleTrayAction("close-desktop")
for _, info := range svc.ListWindowInfos() {
assert.False(t, info.Visible, "window should be hidden after close-desktop")
}
})
t.Run("tray tooltip", func(t *testing.T) {
_, handled, err := svc.handleWSMessage(WSMessage{
Action: "tray:set-tooltip",