Skip to content

feat(settings): keep computer awake while app is running - #1021

Merged
vastsa merged 5 commits into
vastsa:mainfrom
hui455:feat/keep-awake
Sep 24, 2026
Merged

vastsa merged 5 commits into
vastsa:mainfrom
hui455:feat/keep-awake

Conversation

@hui455

@hui455 hui455 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a persisted Keep computer awake setting backed by Electron's prevent-app-suspension blocker. Restore it on startup, update it immediately, and release it on shutdown.
  • Keep the existing prevent-display-sleep setting independent. Validate the new setting in Host and provide translations.
  • Repair existing baseline documentation, style, and main-process architecture gates needed for candidate validation.

Validation

  • Windows Electron/Host E2E: enable, restart, disable, independent display toggle, and powercfg /requests observation.
  • Full JS build, desktop typecheck, Host settings tests, controller tests, docs, lint, architecture, Rust fmt, and prescribed Clippy passed on base 21dcd3d plus the reviewed patch.
  • The full Host suite passed 636/642 tests; six unrelated Windows path/symlink tests failed. An additional warning-as-error Clippy run failed on four warnings in untouched files; prescribed Clippy passed.
  • After integrating upstream main 6e5a879 (Windows MCP fix and model-picker CSS), the full JS build on 921b6d2 and desktop build, typecheck, architecture, docs check, and Windows power E2E on 6e5a879 passed. Lint now fails on two unrelated raw line-height and box-shadow values in upstream composer-menus.css from PRs style: refine model picker UI #1020 and fix: model picker light-mode visibility #1022; this PR does not change that file. Native macOS/Linux power behavior remains unverified.

Specs and compatibility

Updates settings UX and E2E specs. The new setting defaults off; no migration or existing setting behavior changes.

Screenshots

Before (older upstream f91d11e, Windows): Before setting
After, off (reviewed 21dcd3d candidate, Windows): Keep awake off
After, on with screen sleep still allowed (reviewed 21dcd3d candidate, Windows): Keep awake on

Closes #1018

Restore the missing Chinese design-system table and use the matching
radius token so the existing documentation and style gates pass.
Persist an independent app-suspension setting and own its Electron
blocker through startup, setting changes, and shutdown. Cover the
Windows system request and the existing display blocker interaction.
Include the latest upstream model-picker styling without changing the reviewed power behavior.
Include the upstream Windows MCP launch fixes while retaining the reviewed power setting and its test coverage.
Keep the published keep-awake branch current with upstream main while preserving the reviewed power setting and tests.
@vastsa

vastsa commented Sep 24, 2026

Copy link
Copy Markdown
Owner

开发冲突啦,好像我下午提交过这个功能了,你这个是基于那个优化的吗

@hui455

hui455 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

对,是基于你下午新增的 preventScreenSleep 往上补的,不是替换原来的功能。

你那个用的是 prevent-display-sleep,主要是保持屏幕常亮;这个 PR 补的是 prevent-app-suspension,让系统不因为空闲进入休眠,但屏幕还是可以正常熄灭,主要是避免长时间 Agent / 定时任务被系统睡眠中断。

我把两种 blocker 做成了独立开关,也复用了现有 settings 流程。

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review passed. The controller lifecycle, shutdown cleanup, conditional IPC application, independent blocker independence, Rust validation, i18n, and E2E coverage are all correct. The CI lint failure is a pre-existing style-token violation in composer-menus.css from #1020/#1022 — this PR does not touch that file.

@vastsa
vastsa merged commit 287d705 into vastsa:main Sep 24, 2026
3 of 4 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.

[Feature] Keep the computer awake while PI-Desktop is running

2 participants