@@ -150,7 +150,7 @@ def _update_label(self, hwnd: int, win_info: dict, event: WinEvent) -> None:
150
150
removed_hwnds = []
151
151
152
152
for title ,hwnd ,icon ,process in visible_windows :
153
- if hwnd not in self .window_buttons and icon is not None :
153
+ if hwnd not in self .window_buttons :
154
154
self .window_buttons [hwnd ]= (title ,icon ,hwnd ,process )
155
155
new_icons .append ((title ,icon ,hwnd ,process ))
156
156
elif hwnd in existing_hwnds :
@@ -164,8 +164,13 @@ def _update_label(self, hwnd: int, win_info: dict, event: WinEvent) -> None:
164
164
# Remove icons for windows that are no longer visible
165
165
for i in reversed (range (self ._widget_container_layout .count ())):
166
166
widget = self ._widget_container_layout .itemAt (i ).widget ()
167
+ hwnd = widget .property ("hwnd" )
168
+
169
+ widget .setProperty ("class" ,self ._get_icon_class (hwnd ))
170
+ widget .style ().unpolish (widget )
171
+ widget .style ().polish (widget )
172
+
167
173
if widget != self .icon_label :
168
- hwnd = widget .property ("hwnd" )
169
174
if hwnd in removed_hwnds :
170
175
if self ._animation ['enabled' ]:
171
176
self ._animate_icon (widget ,start_width = widget .width (),end_width = 0 )
@@ -176,7 +181,7 @@ def _update_label(self, hwnd: int, win_info: dict, event: WinEvent) -> None:
176
181
# Add new icons
177
182
for title ,icon ,hwnd ,process in new_icons :
178
183
icon_label = QLabel ()
179
- icon_label .setProperty ("class" ,"app-icon" )
184
+ icon_label .setProperty ("class" ,self . _get_icon_class ( hwnd ) )
180
185
if self ._animation ['enabled' ]:
181
186
icon_label .setFixedWidth (0 )
182
187
icon_label .setPixmap (icon )
@@ -189,6 +194,10 @@ def _update_label(self, hwnd: int, win_info: dict, event: WinEvent) -> None:
189
194
if self ._animation ['enabled' ]:
190
195
self ._animate_icon (icon_label ,start_width = 0 ,end_width = icon_label .sizeHint ().width ())
191
196
197
+ def _get_icon_class (self ,hwnd :int )-> str :
198
+ if hwnd == win32gui .GetForegroundWindow ():
199
+ return "app-icon foreground"
200
+ return "app-icon"
192
201
193
202
def _get_app_icon (self ,hwnd :int ,title :str ,process :dict ,event :WinEvent )-> QPixmap | None :
194
203
try :