ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
370 stars 52 forks source link

AppUserModelID (AUMID) improvements #477

Open ProgerXP opened 7 months ago

ProgerXP commented 7 months ago

Windows uses AUMID strings to link different processes together to facilitate taskbar grouping (among other things). Notepad2 model is very simple and Windows' heuristic-based automatic AUMID is already good, but not good enough.

General info about AUMID: https://learn.microsoft.com/en-us/windows/win32/shell/appids

Notepad 2e should set its own AUMID based on the new AppUserModelID preference:

This will allow Notepad2e.exe in different locations but using the same INI file to be grouped. This scenario is common when replacing Windows' built-in Notepad by overwriting %windir%\notepad.exe, %windir%\system32\notepad.exe and %windir%\syswow32\notepad.exe while storing settings in, say, %windir%\Notepad2.ini (as per https://github.com/ProgerXP/Notepad2e?tab=readme-ov-file#ini-file-location).


Related feature: maintain Recent Documents. But first, a question: if Notepad 2e is used in place of Notepad (see above), Windows somehow automatically maintains recent list in the Jump List of processes system32\notepad.exe (to test this, overwrite it with Notepad2e.exe and open a txt, ini or other similar text file). But for Notepad 2e in other places Jump List shows no recent section. How does this work if the code is the same in both processes? Also, why does it change the icon of the grouped button of system32\notepad.exe?

s

The icon is also different if you create a shortcut to system32\notepad.exe or syswow32\notepad.exe - Explorer doesn't even list all icons except that one (use the Change Icon button). It does this for %windir%\notepad.exe though (and in any other paths).

In any case, we should call SHAddToRecentDocs() for each file the user opens (via any means - Ctrl+O, Open Previous, drag & drop, etc.) except for bulk open (#250).