fix: Always prevent display sleep, remove dock icon, add auto-updates#14
Merged
GordonBeeming merged 4 commits intomainfrom Apr 3, 2026
Merged
fix: Always prevent display sleep, remove dock icon, add auto-updates#14GordonBeeming merged 4 commits intomainfrom
GordonBeeming merged 4 commits intomainfrom
Conversation
- Change all PowerAssertionType defaults from preventUserIdleSystemSleep to preventUserIdleDisplaySleep so screens stay on when caffeinated - Remove the "Prevent display sleep" settings toggle (always on now) - Remove the "Show dock icon" settings toggle (always hidden now) - Remove --display CLI flag from caffeinate and for commands - Delete unused DockIconController - Update CLAUDE.md window focus pattern docs Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: GitButler <gitbutler@gitbutler.com>
- Check GitHub Releases API for new versions (hourly + manual) - Show download arrow in menu bar when update available - Download DMG to ~/Downloads and mount for drag-install - AppVersion model in InsomniaCore for version parsing/comparison - 16 new tests for version parsing and comparison logic - Skip periodic checks in dev builds Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: GitButler <gitbutler@gitbutler.com>
Remove @mainactor from UpdateChecker to fix actor-isolation errors in Swift 5.10 strict concurrency mode. Add strict concurrency build command to CLAUDE.md so future changes are tested before pushing. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: GitButler <gitbutler@gitbutler.com>
There was a problem hiding this comment.
Pull request overview
This PR standardizes Insomnia’s caffeination behavior to always prevent display sleep (and thus system sleep), simplifies the GUI to be menu bar–only (no Dock icon toggle / controller), and introduces a basic auto-update flow that checks GitHub Releases and offers a DMG download action.
Changes:
- Switch default power assertion type across core/scheduling/CLI/tests to
PreventUserIdleDisplaySleepand remove the “prevent display sleep” toggle +--displayCLI flag. - Make the GUI always run as an accessory (menu bar–only) app and delete the Dock icon controller and related settings.
- Add a GitHub Releases–based update checker, an update-available indicator in the menu bar label, and menu actions to check/download.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/InsomniaIntegrationTests/PowerAssertionIntegrationTests.swift | Updates assertion expectation to display sleep prevention. |
| Tests/InsomniaCoreTests/PowerAssertionManagerTests.swift | Updates default assertion expectation; removes redundant display-type test. |
| Tests/InsomniaCoreTests/AppVersionTests.swift | Adds coverage for version parsing/comparison used by updater. |
| Sources/InsomniaCore/Scheduling/ScheduleRule.swift | Changes default assertion type to display sleep prevention. |
| Sources/InsomniaCore/Scheduling/CaffeinationScheduler.swift | Changes default assertion type for scheduler entrypoints. |
| Sources/InsomniaCore/Power/PowerAssertionManager.swift | Changes default assertion type for manager APIs (docs need alignment). |
| Sources/InsomniaCore/Models/InsomniaConfiguration.swift | Removes display-sleep toggle; makes preferred assertion type always display sleep. |
| Sources/InsomniaCore/Models/AppVersion.swift | Introduces AppVersion parsing/comparison helper. |
| Sources/InsomniaCLI/Commands/CaffeinateForCommand.swift | Removes --display; always uses default (display sleep prevention). |
| Sources/InsomniaCLI/Commands/CaffeinateCommand.swift | Removes --display; always uses default (display sleep prevention). |
| Sources/Insomnia/Views/SettingsView.swift | Removes display sleep + dock icon settings UI sections. |
| Sources/Insomnia/Views/MenuBarView.swift | Adds update menu section (check/download). |
| Sources/Insomnia/Views/AboutView.swift | Switches icon loading to use the app icon image (current implementation is problematic). |
| Sources/Insomnia/ViewModels/SettingsViewModel.swift | Removes dock icon + display sleep related bindings/side effects. |
| Sources/Insomnia/Update/UpdateChecker.swift | Adds periodic GitHub Releases checks and DMG download/open behavior. |
| Sources/Insomnia/Update/GitHubRelease.swift | Adds minimal Codable model to decode GitHub releases/assets. |
| Sources/Insomnia/InsomniaApp.swift | Injects UpdateChecker into menu view; shows update indicator in menu bar label. |
| Sources/Insomnia/DockIconController.swift | Deleted unused Dock icon controller implementation. |
| Sources/Insomnia/AppDelegate.swift | Always sets accessory mode; wires up UpdateChecker periodic checks. |
| CLAUDE.md | Updates documented window focus pattern for always-accessory app. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Only set isUpdateAvailable when valid DMG URL exists - Gate download button on downloadURL presence in menu UI - Show lastError in update section for user-visible feedback - Validate download URL host against GitHub allowlist - Move file I/O in downloadAndInstall to background thread - Fix NSApp.applicationIconImage optional binding in AboutView - Update all doc comments from "system sleep" to "display sleep" Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: GitButler <gitbutler@gitbutler.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PreventUserIdleDisplaySleepwhen caffeinated (prevents both display and system sleep), removing the toggle that defaulted to system-only--displayCLI flag (now the default behavior)DockIconControllerTest plan
pmset -g assertionsshowsPreventUserIdleDisplaySleep)🤖 Generated with Claude Code