Skip to content

chore: do not off screen on Wayland#133

Merged
MistEO merged 2 commits intoMistEO:mainfrom
litwak913:wl-screenoff
Mar 28, 2026
Merged

chore: do not off screen on Wayland#133
MistEO merged 2 commits intoMistEO:mainfrom
litwak913:wl-screenoff

Conversation

@litwak913
Copy link
Copy Markdown
Contributor

@litwak913 litwak913 commented Mar 28, 2026

由于 Wayland 下还没有统一的合成器协议或 API 接口用于通过 DPMS 关闭屏幕,因此暂时使 screenoff 在 Wayland 平台上直接失败。

Summary by Sourcery

错误修复:

  • 阻止在不支持基于 DPMS 的屏幕电源控制的 Wayland 会话中执行关闭屏幕操作,改为记录错误日志。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Prevent screen-off action from running on Wayland sessions where DPMS-based screen power control is not available, logging an error instead.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我给出了一些总体反馈:

  • 新增的 Wayland 保护条件目前会计算为 false,但并没有从 execute_power_screenoff 返回,所以在 Wayland 下代码仍然会尝试运行 xset;请将内部的 false 替换为显式的 return false;(或者重构为一个提前返回的分支),以确保符合预期行为。
面向 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- The new Wayland guard currently evaluates to `false` without returning from `execute_power_screenoff`, so on Wayland the code will still attempt to run `xset`; replace the inner `false` with an explicit `return false;` (or refactor to an early-return branch) to enforce the intended behavior.

Sourcery 对开源项目免费 —— 如果你觉得我们的评审有帮助,欢迎分享给更多人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • The new Wayland guard currently evaluates to false without returning from execute_power_screenoff, so on Wayland the code will still attempt to run xset; replace the inner false with an explicit return false; (or refactor to an early-return branch) to enforce the intended behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new Wayland guard currently evaluates to `false` without returning from `execute_power_screenoff`, so on Wayland the code will still attempt to run `xset`; replace the inner `false` with an explicit `return false;` (or refactor to an early-return branch) to enforce the intended behavior.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@MistEO MistEO merged commit 2f7485d into MistEO:main Mar 28, 2026
9 checks passed
@litwak913 litwak913 deleted the wl-screenoff branch March 28, 2026 16:14
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.

2 participants