How grouping works
Windows decides which taskbar button a window belongs to by asking the window for an identity — its Application User Model ID. Windows sharing an identity share a button. PerchBar writes the group's identity onto the windows of the group's members, and that is the whole trick.
What follows from that
- It is immediate. Writing the identity onto a window that is already open merges it at once: no restart, no closing and reopening.
- It survives Explorer restarting. The identity is on the window, not in anything PerchBar keeps.
- It lasts the window's lifetime. Close the window and the identity goes with it, which is why PerchBar has to be running to claim the next one.
- Letting go needs a nudge. Removing an identity is not as clean as adding one: the shell often does not notice until the window changes state, so PerchBar minimises and restores the window to make it look again. You may see that flicker when you use Ungroup all windows or disable a group.
- A pinned shortcut carrying the same identity is part of the same button, which is why the group's windows merge into the pin instead of appearing beside it.
How windows are found
PerchBar is told by Windows when a window appears, and claims it if its program belongs to a group. A sweep every few seconds is the backstop, for windows created hidden and shown later. Every claim is recorded together with whatever identity the window had before, so Ungroup all windows can put things back exactly as they were.
Which member a window belongs to is decided by the member's own rule: an exact path, or any folder if that is ticked.
Every window a program puts on the taskbar is claimed, not only its main one. Some applications give a second window a button of its own — a document window, or a viewer alongside the main one — and each of those has to carry the group's identity or Windows would leave it outside the group, which is the one thing PerchBar is for. The readout still counts that as one program, because it is: the extra window belongs to the same one you opened.