Skip to content

Autostart fix#121

Merged
dantheuber merged 2 commits into
mainfrom
autostart-fix
May 31, 2026
Merged

Autostart fix#121
dantheuber merged 2 commits into
mainfrom
autostart-fix

Conversation

@dantheuber

Copy link
Copy Markdown
Owner

Summary

  • Autostart reliability (Windows): Fixes "Auto Start with System" not launching Clipless at login, and makes the setting self-healing across upgrades.
  • Single instance: Clipless now enforces a single running instance and focuses the existing window instead of launching a duplicate — important when autostart fires while the app is already open.
  • Start Minimized: the previously non-functional setting now actually starts the app hidden in the system tray.
  • Trustworthy toggle: the General settings toggle now reflects the real OS login-item state, not just the saved preference, so it can't silently drift from what happens at boot.

Added

  • Single-instance lock via requestSingleInstanceLock() in the main entry point, plus a second-instance handler that restores/shows/focuses the existing window.
  • getAutoStartState() in the autoStart module, exposed through a new auto-start-get-state IPC channel and window.api.getAutoStartState(); the settings toggle now reflects the actual OS login-item state (falls back to the persisted value on Linux/dev).
  • startMinimized is now honored on launch — when enabled, the window stays hidden in the system tray.
  • Unit tests covering the new dev-guard, legacy-entry migration, and OS-state read paths (100% coverage maintained).

Changed

  • AppUserModelId set to com.clipless.app (was the electron-vite template default com.electron). On Windows this value is used as the autostart registry value name, so a unique ID prevents collisions with other Electron apps and stops dev builds from clobbering the installed app's entry.
  • applyAutoStart now manages OS login items only in packaged builds (app.isPackaged), so npm run dev and e2e runs no longer register stray login items pointing at node_modules/electron.

Fixed

  • "Auto Start with System" failing to launch Clipless at login on Windows. Root causes: the generic, shared com.electron AppUserModelId used as the login-item registry name, and dev/e2e runs writing stray login items into the user's Run key.

Removed

  • The legacy com.electron login-item entry is now cleared automatically during reconciliation (self-healing migration to com.clipless.app), so a stale entry can no longer keep launching the app after autostart is turned off — or cause a duplicate launch while it's on.

@github-actions

Copy link
Copy Markdown

📊 Coverage Report

Metric Coverage
Statements 100%
Branches 100%
Functions 100%
Lines 100%

@github-actions

Copy link
Copy Markdown

🧪 E2E Test Results

18 passed, 0 failed, 0 skipped

Test Suite Result
App Launch
Clipboard
Context Menu
Image Clipboard
Quick Clips
Settings
Theme
Settings — Search Terms CRUD
Settings — Quick Tools CRUD
Settings — Templates CRUD
Tools Launcher — Pattern Scanning
Tools Launcher — Clip Templates

@dantheuber dantheuber merged commit cefbc72 into main May 31, 2026
3 checks passed
@dantheuber dantheuber deleted the autostart-fix branch May 31, 2026 07:42
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