Skip to content

feat: launch on Windows startup#10

Closed
KristianP26 wants to merge 3 commits into
DavidHruby1:mainfrom
KristianP26:feat/autostart
Closed

feat: launch on Windows startup#10
KristianP26 wants to merge 3 commits into
DavidHruby1:mainfrom
KristianP26:feat/autostart

Conversation

@KristianP26

Copy link
Copy Markdown
Contributor

What

Adds an opt-in "Start with Windows" toggle in the Settings dialog (General tab). When enabled, Screamer launches automatically at login.

How

  • Registers the running executable under the per-user HKCU\Software\Microsoft\Windows\CurrentVersion\Run key.
  • Uses winreg (stdlib, zero new deps), lazily imported so config.py still imports cleanly off Windows.
  • Registry is the source of truth: load_config() reconciles the autostart field from the actual registry state, so the checkbox always reflects reality.
  • The registry write happens where the user commits changes (Apply / OK), not in save_config — plain setting writes (e.g. tray toggles) stay registry-free. Failures surface as a warning dialog (AppError.AUTOSTART_FAILED).
  • Frozen builds register the bundled exe; a dev checkout falls back to python -m src.main (documented limitation).

API additions (config.py)

  • set_autostart(enabled: bool) -> None
  • is_autostart_enabled() -> bool
  • AppConfig.autostart: bool

Both documented in docs/IMPLEMENTATION.md.

Tests

5 cross-platform tests in tests/test_config.py (registry mocked): default off, non-Windows no-op/False, and the frozen-vs-dev command. Full suite passes (34 tests). Verified the real HKCU enable→query→disable roundtrip on Windows.

Commits

  1. feat(config) — registry helpers, AppConfig.autostart, load_config reconcile, AUTOSTART_FAILED, tests
  2. feat(settings) — General-tab checkbox + apply on Apply/OK
  3. docs — IMPLEMENTATION.md contract, README, implementation plan

Add set_autostart / is_autostart_enabled backed by the per-user HKCU Run key
(winreg, zero deps, lazily imported so the module still imports off Windows).
AppConfig gains an `autostart` field; load_config reconciles it from the
registry, which is the source of truth. New AppError.AUTOSTART_FAILED surfaces
registry write failures. Cross-platform tests mock the registry.
General-tab checkbox bound to AppConfig.autostart. The registry side effect is
applied where the user commits changes (Apply and OK) via a small helper, with
a warning dialog on failure — kept out of save_config so plain setting writes
stay registry-free.
Add the config.py autostart contract to IMPLEMENTATION.md, note the feature in
the README, and check in the implementation plan.
@KristianP26

Copy link
Copy Markdown
Contributor Author

Closing — autostart already landed in main via src/startup.py (pythonw-based, more complete). This PR duplicates it.

@KristianP26 KristianP26 closed this Jun 2, 2026
@KristianP26 KristianP26 deleted the feat/autostart branch June 2, 2026 12:55
DavidHruby1 added a commit that referenced this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant