Skip to content

fix(desktop): allow display sleep while app stays active#436

Merged
anthhub merged 1 commit intomainfrom
fix/desktop-sleep-guard-lockscreen
Mar 24, 2026
Merged

fix(desktop): allow display sleep while app stays active#436
anthhub merged 1 commit intomainfrom
fix/desktop-sleep-guard-lockscreen

Conversation

@anthhub
Copy link
Copy Markdown

@anthhub anthhub commented Mar 23, 2026

Summary

  • change the desktop sleep guard default from prevent-display-sleep to prevent-app-suspension
  • keep the app active during idle without forcing the display to stay on
  • update the desktop sleep guard tests to cover the downgraded blocker mode

Verification

  • pnpm typecheck
  • pnpm test
  • pnpm lint

Fixes #434

Summary by CodeRabbit

  • Changes
    • Updated the default sleep blocker behavior to prevent app suspension instead of display sleep prevention, affecting how the system manages power states.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff0d277b-1b20-4bf8-a1fe-74aca0a368e3

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 554f7c8 and 501cec8.

πŸ“’ Files selected for processing (2)
  • apps/desktop/main/sleep-guard.ts
  • tests/desktop/sleep-guard.test.ts

πŸ“ Walkthrough

Walkthrough

The default SleepGuard blocker type was changed from "prevent-display-sleep" to "prevent-app-suspension". This affects the fallback behavior when no explicit blocker type is specified during sleep guard snapshot initialization. Test assertions were updated to reflect this new default.

Changes

Cohort / File(s) Summary
Sleep Guard Default Configuration
apps/desktop/main/sleep-guard.ts
Updated DEFAULT_BLOCKER_TYPE constant value from "prevent-display-sleep" to "prevent-app-suspension", affecting the default behavior of createInitialSleepGuardSnapshot() when invoked without explicit blockerType parameter.
Sleep Guard Tests
tests/desktop/sleep-guard.test.ts
Updated test assertions to expect the new default blocker type "prevent-app-suspension" instead of "prevent-display-sleep" across blocker state checks, snapshot field validations, and lifecycle log message assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops with glee at suspension's new way,
No more sleep locks to ruin the day,
Apps may drift but the screen runs free,
Changes made for harmony! ✨

πŸš₯ Pre-merge checks | βœ… 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers key changes and verification steps, but lacks detailed sections for Why, How, and Affected areas as specified in the template. Add structured sections (What, Why, How, Affected areas, Checklist) following the repository template for completeness and clarity.
βœ… Passed checks (3 passed)
Check name Status Explanation
Title check βœ… Passed The title accurately describes the main change: switching from preventing display sleep to allowing display sleep while keeping the app active.
Linked Issues check βœ… Passed The PR successfully addresses issue #434 by changing the blocker type from prevent-display-sleep to prevent-app-suspension, allowing the system to lock while the app remains running.
Out of Scope Changes check βœ… Passed All changes are directly related to the linked issue #434: updating the sleep guard blocker type and corresponding tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/desktop-sleep-guard-lockscreen

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@anthhub anthhub merged commit ba3c74c into main Mar 24, 2026
7 checks passed
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.

Prevent computer from auto-locking/sleeping

2 participants