···11+# Classic Inno Setup Installer + Startup Fallback — Design
22+33+**Date:** 2026-07-14
44+**Status:** Approved (brainstorming)
55+66+## Goal
77+88+Distribute TaskbarCalculator from the project's own website
99+(`https://taskbar-calculator.marcomaroni.it/`) as a classic, **unsigned**, **per-user**
1010+self-installing setup built with **Inno Setup**, while keeping the Microsoft Store (MSIX)
1111+path open for later. Unsigned means users see the usual SmartScreen "unknown publisher"
1212+prompt — acceptable for now (the previous public installer was also unsigned).
1313+1414+## Part 1 — Start-at-login fallback in `StartupManager`
1515+1616+The tray "Start at login" toggle currently uses the MSIX `StartupTask` WinRT API, which
1717+requires package identity. In a classic (unpackaged) install it returns `Unavailable` and
1818+the menu item is grayed. Add a **registry fallback** so the same binary works both ways.
1919+2020+- Key: `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, value name `TaskbarCalculator`,
2121+ data = the quoted full path of the running exe (`GetModuleFileNameW`).
2222+- `Get()`: try `StartupTask` (packaged/Store); on exception, return `Enabled`/`Disabled`
2323+ based on whether the `Run` value exists.
2424+- `Set(on)`: try `StartupTask`; on exception, create/delete the `Run` value.
2525+2626+Effect: identical exe supports both channels — `StartupTask` on the Store, `Run` key with
2727+the classic installer. In the classic install the menu item becomes **enabled and
2828+functional**. `State::Unavailable` is effectively no longer returned (kept in the enum as a
2929+safety value).
3030+3131+## Part 2 — Inno Setup script
3232+3333+New file `Packaging/TaskbarCalculatorSetup.iss` producing `TaskbarCalculatorSetup.exe`.
3434+3535+- **Per-user:** `PrivilegesRequired=lowest`, `DefaultDirName={autopf}\TaskbarCalculator`
3636+ (resolves to `%LocalAppData%\Programs\TaskbarCalculator`); no UAC.
3737+- **Metadata:** x64 only, icon `icon1.ico`, version `3.0.0`, publisher "Marco Maroni",
3838+ URL `https://taskbar-calculator.marcomaroni.it/`.
3939+- **Files:** `x64\Release\TaskbarCalculator.exe` → `{app}`.
4040+- **Icons:** Start-menu shortcut + Uninstall entry. No desktop icon.
4141+- **[Tasks]:** `startup` — checkbox "Avvia Taskbar Calculator all'accesso a Windows",
4242+ **preselected** (default checked). When selected, an install-time `[Registry]` entry
4343+ writes the `Run` value.
4444+- **[Run]:** postinstall checkbox "Avvia Taskbar Calculator" (runs the app after setup).
4545+- **Running-instance handling:** `taskkill /im TaskbarCalculator.exe /f` in
4646+ `PrepareToInstall` (for upgrades over a running instance) and on uninstall.
4747+- **Clean uninstall:** `[Code] CurUninstallStepChanged` always deletes the `Run` value
4848+ (whether written by the installer or by the app's tray toggle), so nothing is orphaned.
4949+5050+## Build / tooling
5151+5252+- Compiling `.iss` requires **Inno Setup's `ISCC.exe`** (free). If not installed, the script
5353+ is delivered as-is and the compile step is done once Inno Setup is present.
5454+- `Packaging/*.exe` (the generated `TaskbarCalculatorSetup.exe`) is git-ignored.
5555+5656+## Testing
5757+5858+- **StartupManager fallback (runtime):** unpackaged, `Set(true)` creates the `Run` value,
5959+ `Set(false)` removes it, `Get()` reflects the state. Verified by a temporary exit-code
6060+ harness + registry inspection (as used for the Settings/Startup checks).
6161+- **Inno script:** compile with `ISCC.exe` to validate; the produced
6262+ `TaskbarCalculatorSetup.exe` is smoke-tested by the user (per-user install, Start-menu
6363+ shortcut, autostart checkbox, run-after-install, uninstall removes app + Run value).
6464+6565+## Out of scope (YAGNI)
6666+6767+- Code signing (unsigned for now; SmartScreen prompt accepted).
6868+- Per-machine install / desktop shortcut.
6969+- Auto-update mechanism (the site hosts the latest `setup.exe`).
7070+- Microsoft Store submission (kept open as a future path; no work now).