Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sgm1018/BetterWinTab/llms.txt
Use this file to discover all available pages before exploring further.
FolderService is the central authority for managing window folders (categories) in BetterWinTab. It holds a live ObservableCollection<WindowFolder> that the UI binds to, handles all filter evaluation against enumerated windows, and serializes/deserializes folder configuration through AppSettings. The service distinguishes between the built-in All Windows folder, user-created smart and manual folders, and the two singleton special folders — Clipboard and Recycle Bin.
Constructor
FolderService(WindowEnumerationService)
Initializes the service and immediately adds the built-in All Windows folder as the first entry in Folders.
The window enumeration service used by
RefreshAllFolders and RefreshFolder to obtain the current list of open windows.Properties
Folders
FolderType.All) is always at index 0 (SortOrder = 0).
Methods
RefreshAllFolders()
Re-evaluates every folder’s filter rules against the current set of open windows. Internally calls WindowEnumerationService.GetAllWindows() once and passes the result to RefreshFolder for each folder, avoiding redundant enumeration.
Clipboard (
FolderType.Clipboard) and Recycle Bin (FolderType.RecycleBin) folders are skipped — their Windows collections are always cleared and left empty because they represent actions rather than window groups.RefreshFolder(WindowFolder, List<WindowInfo>?)
Refreshes a single folder’s Windows collection. If allWindows is not supplied the service calls GetAllWindows() internally.
The folder whose
Windows collection should be rebuilt. The collection is cleared before repopulating.An optional pre-fetched window list. Pass this when you are refreshing multiple folders in a loop to avoid redundant system calls.
FolderType:
FolderType | Filter behaviour |
|---|---|
All | All enumerated windows |
SmartProcess | Windows whose ProcessName matches folder.ProcessFilter (case-insensitive) |
SmartClass | Windows whose ClassName matches folder.ClassNameFilter (case-insensitive) |
SmartRules | Windows matched by folder.Rules.Matches(w); falls back to all windows when Rules is null |
Manual | Windows whose Handle is in folder.ManualWindowHandles |
Clipboard | No-op — collection left empty |
RecycleBin | No-op — collection left empty |
CreateSmartProcessFolder(string, string, string, string)
Creates a new smart folder that automatically populates itself with all windows belonging to a specific process.
Display name shown in the folder sidebar (e.g.
"Chrome").The process name to filter by — case-insensitive match against
WindowInfo.ProcessName (e.g. "chrome", "Code").Segoe MDL2 / Fluent icon glyph. Defaults to the Tag icon (
\uE756).Hex background tint applied to the folder tile. Defaults to a dark green.
The newly created folder, already appended to
Folders with SortOrder set to the current collection count.CreateManualFolder(string, string, string)
Creates a new manual folder where windows are assigned explicitly by the user rather than matched by a rule.
Display name for the folder.
Segoe MDL2 icon glyph. Defaults to the Folder icon (
\uE8B7).Hex background tint. Defaults to a dark blue-grey.
The newly created folder, appended to
Folders.CreateSmartRulesFolder(string, FolderRuleGroup, string, string)
Creates a composite rules folder (v2 smart folder) that evaluates multiple conditions with AND/OR logic via a FolderRuleGroup.
Display name for the folder.
The composite rule group. Each condition in the group is evaluated by calling
rules.Matches(WindowInfo).Segoe MDL2 icon glyph.
Hex background tint. Defaults to a dark green.
The newly created folder, appended to
Folders.CreateClipboardFolder()
Creates the special Clipboard History folder and appends it to Folders.
A new
WindowFolder with Type = FolderType.Clipboard, Name = "Clipboard", icon \uE8C8 (Copy), and background #2A2A3D.This is a singleton folder — only one Clipboard folder should exist at a time.
RemoveFolder will refuse to delete it, so you must ensure CreateClipboardFolder() is not called more than once during a session. Check for an existing FolderType.Clipboard entry in Folders before calling.CreateRecycleBinFolder()
Creates the special Recycle Bin folder and appends it to Folders. Clicking this folder in the overlay opens the Windows Recycle Bin shell view and hides the overlay.
A new
WindowFolder with Type = FolderType.RecycleBin, Name = "Recycle Bin", icon \uE74D (Delete), and background #2A2A2A.Like the Clipboard folder, this is a singleton — only one Recycle Bin folder should exist at a time. Check for an existing
FolderType.RecycleBin entry in Folders before calling.RemoveFolder(string)
Removes a folder from Folders by its unique Id string.
The
WindowFolder.Id (a Guid string) of the folder to remove.true if the folder was found and successfully removed; false if the folder was not found or is a protected built-in type.LoadFromSettings(AppSettings)
Restores the full folder list from a previously saved AppSettings object. The current Folders collection is cleared and rebuilt from scratch.
The settings object to read folders from. Folders with
Type == FolderType.All present in settings.Folders are ignored — a fresh All Windows folder is always prepended.Folders.Clear()- Add a new All Windows folder at
SortOrder = 0 - Add all non-
Allfolders fromsettings.Folders, ordered bySortOrderascending
SaveToSettings(AppSettings)
Writes the current folder list (excluding the All Windows folder) to settings.Folders, re-numbering SortOrder values starting from 1.
The settings object whose
Folders list will be replaced. The All Windows folder (FolderType.All) is excluded from the saved list since it is always reconstructed on load.SortOrder values are reassigned as 1, 2, 3, … in the current display order when saving — any previous SortOrder values are discarded.