Skip to main content

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.

SettingsService is responsible for reading and writing the application configuration to disk and for managing the Windows startup registry entry. Settings are stored as indented camelCase JSON in the user’s roaming %APPDATA% directory. All I/O errors are caught and written to System.Diagnostics.Debug output rather than propagated as exceptions, so callers do not need try/catch wrappers.

Storage locations

ResourcePath
Settings file%APPDATA%\BetterWinTab\settings.json
Settings directory%APPDATA%\BetterWinTab\
Startup registry keyHKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Startup registry value nameBetterWinTab

Sample settings.json

{
  "folders": [
    {
      "id": "a1b2c3d4-...",
      "name": "Browsers",
      "icon": "\uE756",
      "backgroundColor": "#2D3A2D",
      "type": 2,
      "processFilter": "chrome",
      "sortOrder": 1
    }
  ],
  "hotkeyModifiers": 2,
  "hotkeyVKey": 9,
  "showLivePreviews": true,
  "thumbnailWidth": 320,
  "thumbnailHeight": 200,
  "appearance": {
    "accentColor": "#39FF14",
    "backgroundColor": "#000000"
  },
  "runAtStartup": false,
  "clipboardHistoryMaxItems": 50,
  "clipboardHistoryEnabled": true,
  "hasCompletedOnboarding": false
}
The file is serialized with JsonNamingPolicy.CamelCase and WriteIndented = true.

Methods

Load()

Reads settings.json from disk and deserializes it into an AppSettings object. If the file does not exist or deserialization fails for any reason, a default new AppSettings() instance is returned — the application always starts in a valid state.
public AppSettings Load()
return
AppSettings
The deserialized settings, or a default AppSettings instance if the file is absent or unreadable. Errors are written to Debug.WriteLine and do not throw.
Example:
var settingsService = new SettingsService();
AppSettings settings = settingsService.Load();

Save(AppSettings)

Serializes the provided AppSettings object to camelCase JSON and writes it to settings.json. Creates %APPDATA%\BetterWinTab\ if it does not already exist. Errors are caught and written to Debug.WriteLine — the method never throws.
public void Save(AppSettings settings)
settings
AppSettings
required
The settings object to persist. All public properties are serialized.
Example:
settings.ShowLivePreviews = false;
settingsService.Save(settings);

GetRunAtStartup()

Checks whether a BetterWinTab value exists under HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run to determine if the application is registered to launch at Windows sign-in.
public bool GetRunAtStartup()
return
bool
true if the BetterWinTab registry value is present (regardless of its data); false if the value is absent or the registry key cannot be opened. Errors are caught silently.
Registry path:
HKEY_CURRENT_USER
  └─ SOFTWARE\Microsoft\Windows\CurrentVersion\Run
       └─ BetterWinTab  REG_SZ  "C:\...\BetterWinTab.exe"

SetRunAtStartup(bool)

Adds or removes the Windows startup registry entry for BetterWinTab.
public void SetRunAtStartup(bool enable)
enable
bool
required
  • true — writes the current executable path (quoted) as the BetterWinTab value under HKCU\...\Run.
  • false — deletes the BetterWinTab value if it exists; no-op if already absent.
When enable is true, the path is obtained from Process.GetCurrentProcess().MainModule?.FileName and written as a quoted string, e.g.:
"C:\Users\Alice\AppData\Local\BetterWinTab\BetterWinTab.exe"
If MainModule?.FileName is null or empty, no registry write occurs. Errors are caught silently and written to Debug.WriteLine. Example — toggle based on a settings property:
settingsService.SetRunAtStartup(settings.RunAtStartup);

Build docs developers (and LLMs) love