On Windows 10 there are issues with pinning app to taskbar, sometimes duplicate app icons appear on taskbar or sometimes updating taskbar icon doesn't work. On Windows 10 applications are required to set AppUserModelID (AppID) string that uniquely identifies application on taskbar and allows to group app's seperate windows under a single taskbar button [1]. If application uses multiple processes it should set AppID for each of these processes (especially UI processes that create windows). A win32 function for that is SetCurrentProcessExplicitAppUserModelID
[2].
A Python application can make such call in the Python/Browser process using such code:
import sys if "win32" in sys.platform: import ctypes from ctypes.wintypes import HRESULT PCWSTR = ctypes.c_wchar_p AppUserModelID = ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID AppUserModelID.argtypes = [PCWSTR] AppUserModelID.restype = HRESULT # An identifier that is globally unique for all apps running on Windows app_id = "change_this_to_some_unique_id" hresult = AppUserModelID(app_id) assert hresult == 0, "SetCurrentProcessExplicitAppUserModelID failed"
But that seems not enough. MSDN documentation [1] states that all app processes should set AppID. It seems that it is necessary to set it also for the Browser and Renderer processes in Chromium, as both of these processes create win32 windows. These two pull requests in the Electron and Atom project confirm that [3] [4].
The solution would be to pass the --app-user-model-id
flag as a switch to cef.Initialize()
. First this flag would need to be propagated from the Browser process to other processes and I think that passing switch to cef.Initialize()
is enough to do that. Then the subprocess C++ code would need to check if this flag was passed and call SetCurrentProcessExplicitAppUserModelID
[2] in that case, probably somewhere in src/subprocess/cefpython_app.cpp
.
It is worth noting, even though it is a bit off-topic here, that it is also required to set AppUserModelID (AppID) property for app shortcuts (Desktop shortcut, Quick launch shortcut, Start > Programs shortcut) that are created by application installer. For example in Inno Setup this can be specified using the AppUserModelID
option in the [Icons]
section [5]. Googling for "9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3" [6] returns results from Microsoft documentation related to setting AppUserModelID for app shortcuts. That GUID was taken from Squirrel code [7]. Here you can find registry file that enables additional information about app shortcut when clicking properties on it and that includes displaying AppUserModelID property [8].
Ref:
[1] https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/windows/desktop/dd378422(v=vs.85).aspx
[3] electron/electron#2175
[4] atom/atom#8170
[5] http://www.jrsoftware.org/ishelp/topic_iconssection.htm
[6] https://www.google.com/search?q=%229F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3%22&hl=en&gfe_rd=cr&gws_rd=cr
[7] https://github.com/Squirrel/Squirrel.Windows/blob/8877944cf21a58c18341d6640bed2014582d1380/src/Squirrel/ShellFile.cs#L83
[8] http://winaero.com/blog/how-to-show-more-details-for-shortcuts-in-windows-8-1-windows-8-and-windows-7/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4