Implement tray close-desktop action
This commit is contained in:
parent
4f03fc4c64
commit
483c408497
2 changed files with 16 additions and 1 deletions
|
|
@ -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{})
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue