diff --git a/internal/ui/bar.go b/internal/ui/bar.go index 3e799583..a0a1365d 100644 --- a/internal/ui/bar.go +++ b/internal/ui/bar.go @@ -160,10 +160,20 @@ func (b *bar) WindowRemoved(win fynedesk.Window) { if icon.windowData == nil || win != icon.windowData.win { continue } - if !win.Iconic() { - b.removeFromTaskbar(icon) - b.icons = append(b.icons[:i], b.icons[i+1:]...) + + b.removeFromTaskbar(icon) + b.icons = append(b.icons[:i], b.icons[i+1:]...) + break + } +} + +func (b *bar) WindowStateChanged(win fynedesk.Window) { + for _, icon := range b.icons { + if icon.windowData == nil || win != icon.windowData.win { + continue } + + icon.Refresh() break } } diff --git a/internal/ui/baricon.go b/internal/ui/baricon.go index e5914554..94f8c852 100644 --- a/internal/ui/baricon.go +++ b/internal/ui/baricon.go @@ -66,6 +66,12 @@ func (bi *barIconRenderer) Refresh() { } bi.Layout(bi.image.Size()) + if bi.image.windowData != nil && bi.image.windowData.win.Iconic() { + if img, ok := bi.objects[0].(*canvas.Image); ok { + img.Translucency = 0.67 + } + } + canvas.Refresh(bi.image) } diff --git a/internal/ui/switcher.go b/internal/ui/switcher.go index 10e471df..dba65e2e 100644 --- a/internal/ui/switcher.go +++ b/internal/ui/switcher.go @@ -47,7 +47,7 @@ func (s *switchIcon) CreateRenderer() fyne.WidgetRenderer { bg.CornerRadius = theme.InputRadiusSize() img := canvas.NewImageFromResource(res) if s.win.Iconic() { - img.Translucency = 0.8 + img.Translucency = 0.67 } text := widget.NewLabelWithStyle(title, fyne.TextAlignCenter, fyne.TextStyle{}) text.Truncation = fyne.TextTruncateEllipsis diff --git a/internal/x11/win/client.go b/internal/x11/win/client.go index 4fe1a167..a8242d93 100644 --- a/internal/x11/win/client.go +++ b/internal/x11/win/client.go @@ -246,8 +246,8 @@ func (c *client) NotifyFullscreen() { } func (c *client) NotifyIconify() { - c.frame.hide() c.iconic = true + c.frame.hide() x11.WindowExtendedHintsAdd(c.wm.X(), c.win, "_NET_WM_STATE_HIDDEN") } diff --git a/internal/x11/wm/events.go b/internal/x11/wm/events.go index 346f0528..c600816e 100644 --- a/internal/x11/wm/events.go +++ b/internal/x11/wm/events.go @@ -102,8 +102,10 @@ func (x *x11WM) handleClientMessage(ev xproto.ClientMessageEvent) { switch ev.Data.Bytes()[0] { case icccm.StateIconic: c.NotifyIconify() + x.publishWindowChange(c) case icccm.StateNormal: c.NotifyUnIconify() + x.publishWindowChange(c) } case "_NET_ACTIVE_WINDOW": x.handleActiveWin(ev) diff --git a/internal/x11/wm/stack.go b/internal/x11/wm/stack.go index 87588470..9ba84d1f 100644 --- a/internal/x11/wm/stack.go +++ b/internal/x11/wm/stack.go @@ -121,6 +121,12 @@ func (s *stack) indexForWin(win fynedesk.Window) int { return pos } +func (s *stack) publishWindowChange(win fynedesk.Window) { + for _, l := range s.listeners { + l.WindowStateChanged(win) + } +} + func (s *stack) removeFromStack(win fynedesk.Window) { pos := s.indexForWin(win) diff --git a/modules/desktops/pager.go b/modules/desktops/pager.go index 57ce7a21..65e93367 100644 --- a/modules/desktops/pager.go +++ b/modules/desktops/pager.go @@ -60,6 +60,9 @@ func (p *pager) WindowRemoved(_ fynedesk.Window) { p.refresh() } +func (p *pager) WindowStateChanged(_ fynedesk.Window) { +} + func (p *pager) refresh() { desk := fynedesk.Instance() p.refreshFrom(desk.Desktop()) diff --git a/wm.go b/wm.go index 618fbbd4..47ad37e7 100644 --- a/wm.go +++ b/wm.go @@ -36,6 +36,7 @@ type Stack interface { type StackListener interface { WindowAdded(Window) WindowRemoved(Window) + WindowStateChanged(Window) WindowMoved(Window) WindowOrderChanged()