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
| Resource | Path |
|---|---|
| Settings file | %APPDATA%\BetterWinTab\settings.json |
| Settings directory | %APPDATA%\BetterWinTab\ |
| Startup registry key | HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run |
| Startup registry value name | BetterWinTab |
Sample settings.json
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.
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.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.
The settings object to persist. All public properties are serialized.
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.
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.SetRunAtStartup(bool)
Adds or removes the Windows startup registry entry for BetterWinTab.
true— writes the current executable path (quoted) as theBetterWinTabvalue underHKCU\...\Run.false— deletes theBetterWinTabvalue if it exists; no-op if already absent.
enable is true, the path is obtained from Process.GetCurrentProcess().MainModule?.FileName and written as a quoted string, e.g.:
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: