Status: NOT REPRODUCED. This was found by reading the source, not by observing the behavior. The failure mode below is the expected consequence of the missing call on Windows, but nobody has confirmed it happens to VoxKit. Reproduce before spending time on a fix — it may not affect us in practice.
Summary
main.py never calls SetCurrentProcessExplicitAppUserModelID. On Windows, a process without an explicit AppUserModelID (AUMID) gets one inferred by the shell from the process image path, which for a PyInstaller --onefile build is the extracted temp executable rather than a stable location.
Expected consequence
Windows groups taskbar buttons and matches a running window to its pinned shortcut by AUMID. Without an explicit one, the usual symptoms are:
- A pinned VoxKit shortcut and the running VoxKit window occupy two separate taskbar buttons instead of one.
- The running window's button shows a different icon than the pinned shortcut, because the two resolve their icons through different paths.
- "Pin to taskbar" from the running window pins something that doesn't relaunch cleanly.
Under --onefile this is more likely than usual, since the extracted image path changes between runs.
Why it's filed now
Came up while reviewing 65bd138 (Ship the application icon in packaged builds). That commit added QApplication.setWindowIcon / QMainWindow.setWindowIcon, which control the in-app window icon only. AUMID is a separate mechanism and is not addressed by it, so it's tracked separately here rather than folded into the icon work.
Reproduction (to be attempted)
- Build with
invoke windows-build.
- Run
dist/VoxKit.exe, pin it to the taskbar from the running window.
- Close the app, relaunch from the pinned shortcut.
- Check whether the running window shares the pinned button or creates a second one, and whether the two icons match.
If step 4 shows a single button with a consistent icon, close this as not applicable.
Fix if confirmed
Set the AUMID before any window is created, i.e. before QApplication is constructed in main.py:
if sys.platform == "win32":
import ctypes
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("VoxKit")
The same string must be applied to the installer-generated shortcut (System.AppUserModel.ID) or the two still won't match.
Related
Summary
main.pynever callsSetCurrentProcessExplicitAppUserModelID. On Windows, a process without an explicit AppUserModelID (AUMID) gets one inferred by the shell from the process image path, which for a PyInstaller--onefilebuild is the extracted temp executable rather than a stable location.Expected consequence
Windows groups taskbar buttons and matches a running window to its pinned shortcut by AUMID. Without an explicit one, the usual symptoms are:
Under
--onefilethis is more likely than usual, since the extracted image path changes between runs.Why it's filed now
Came up while reviewing 65bd138 (
Ship the application icon in packaged builds). That commit addedQApplication.setWindowIcon/QMainWindow.setWindowIcon, which control the in-app window icon only. AUMID is a separate mechanism and is not addressed by it, so it's tracked separately here rather than folded into the icon work.Reproduction (to be attempted)
invoke windows-build.dist/VoxKit.exe, pin it to the taskbar from the running window.If step 4 shows a single button with a consistent icon, close this as not applicable.
Fix if confirmed
Set the AUMID before any window is created, i.e. before
QApplicationis constructed inmain.py:The same string must be applied to the installer-generated shortcut (
System.AppUserModel.ID) or the two still won't match.Related