Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4cd5e56

Browse files
authored
Merge pull request#149 from arthurferrai/taskbar-fix
Fixed taskbar not showing all apps icons
2 parentsf33ffe5 +f27b5c3 commit4cd5e56

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

‎src/core/widgets/yasb/taskbar.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importlogging
2+
fromtypingimportOptional
23
fromsettingsimportDEBUG
34
fromcore.widgets.baseimportBaseWidget
45
fromcore.utils.win32.windowsimportWinEvent
@@ -21,7 +22,9 @@
2122
SystemEventListener=None
2223
logging.warning("Failed to load Win32 System Event Listener")
2324

24-
25+
# Missing from win32con
26+
WS_EX_NOREDIRECTIONBITMAP=0x20_0000
27+
2528
classTaskbarWidget(BaseWidget):
2629
validation_schema=VALIDATION_SCHEMA
2730
update_event=pyqtSignal(int,WinEvent)
@@ -54,7 +57,7 @@ def __init__(
5457
self._padding=container_padding
5558
self._win_info=None
5659
self._update_retry_count=0
57-
60+
5861
self._icon_cache=dict()
5962
self.window_buttons= {}
6063
self._event_service=EventService()
@@ -186,18 +189,15 @@ def _update_label(self, hwnd: int, win_info: dict, event: WinEvent) -> None:
186189
ifself._animation['enabled']:
187190
self._animate_icon(icon_label,start_width=0,end_width=icon_label.sizeHint().width())
188191

189-
192+
190193
def_get_app_icon(self,hwnd:int,title:str,process:dict,event:WinEvent)->QPixmap|None:
191194
try:
192-
ifhwnd!=win32gui.GetForegroundWindow():
193-
returnNone
194-
195195
pid=process["pid"]
196196
cache_key= (hwnd,title,pid,self.dpi)
197-
197+
198198
ifevent!=WinEvent.WinEventOutOfContext:
199199
self._update_retry_count=0
200-
200+
201201
ifcache_keyinself._icon_cache:
202202
icon_img=self._icon_cache[cache_key]
203203
else:
@@ -212,7 +212,7 @@ def _get_app_icon(self, hwnd: int, title: str, process: dict, event: WinEvent) -
212212
ifself._update_retry_count<10:
213213
self._update_retry_count+=1
214214
QTimer.singleShot(
215-
500,
215+
500,
216216
lambda:self._get_app_icon(hwnd,title,process,WinEvent.WinEventOutOfContext)
217217
)
218218
returnNone
@@ -232,24 +232,25 @@ def _get_app_icon(self, hwnd: int, title: str, process: dict, event: WinEvent) -
232232
ifDEBUG:
233233
logging.exception(f"Failed to get icons for window with HWND{hwnd} emitted by event{event}")
234234
returnNone
235-
236-
237-
defget_visible_windows(self,hwnd:int,win_info:dict,event:WinEvent)->None:
235+
236+
237+
defget_visible_windows(self,_:int,win_info:dict,event:WinEvent)->list[tuple[str,int,Optional[QPixmap],WinEvent]]:
238238
process=win_info['process']
239239
defis_window_visible_on_taskbar(hwnd):
240-
ifwin32gui.IsWindowVisible(hwnd)andwin32gui.GetWindowText(hwnd):
240+
ifwin32gui.IsWindowVisible(hwnd):
241241
ex_style=win32gui.GetWindowLong(hwnd,win32con.GWL_EXSTYLE)
242-
ifnot (ex_style&win32con.WS_EX_TOOLWINDOW):
242+
ifnot (ex_style&win32con.WS_EX_TOOLWINDOWorex_style==WS_EX_NOREDIRECTIONBITMAP):
243243
returnTrue
244244
returnFalse
245245

246246
visible_windows= []
247247

248-
defenum_windows_proc(hwnd,lParam):
248+
defenum_windows_proc(hwnd,_):
249249
ifis_window_visible_on_taskbar(hwnd):
250250
title=win32gui.GetWindowText(hwnd)
251251
icon=self._get_app_icon(hwnd,title,process,event)
252-
visible_windows.append((title,hwnd,icon ,process))
252+
iftitleandicon:
253+
visible_windows.append((title,hwnd,icon,process))
253254
returnTrue
254255
win32gui.EnumWindows(enum_windows_proc,None)
255256
returnvisible_windows

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp