Keep Windows awake when dbus is inhibited from idle, sleep

オープン
#42,121 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, linux

調査の方向性

Start by tracing how /keep-awake currently uses the systemd integration and where it could observe changes to BlockInhibited. The issue proposes responding to idle, sleep, or shutdown inhibition with SetThreadExecutionState, then clearing the state when the property is empty; no files or tests are named. Done means Windows stays awake while the relevant inhibition is active and returns to normal afterward.

索引モデルが issue の本文から書いたものです。

説明

feature

Is your feature request related to a problem? Please describe.

I use Copilot CLI in WSL2 and have /keep-awake enabled. That does call the org.freedesktop.login1.Manager.Inhibit API to inhibit idle detection. This does not, however, prevent my Windows machine from going idle and eventually to sleep.

Describe the solution you'd like

Monitor for property changed to BlockInhibited and SetThreadExecutionState accordingly e.g., probably when you see any of "idle", "sleep", or "shutdown"—which can be combined e.g., "sleep:idle"—call SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_CONTINUOUS). When the new property value is empty, SetThreadExecutionState(ES_CONTINUOUS) to clear it. As a service, you also have options to "discourage" shutting down when you see dbus signal "shutdown" through SCM messages.

Describe alternatives you've considered

I could use a systemd service to monitor events and write to stdout, listening to it from a WSL plugin. I could also use a number of executables including something like pipeferry or npiperelay to establish a pipe and listen to that from Windows. More moving parts, but no code signing requirement like WSL plugins either.

Additional context

See https://gist.github.com/heaths/b155cb7120b89a2a1c626f9d1cca2a0f (Rust) for how you can filter events to avoid getting flooded. This is a simple sync example but these I would expect would be infrequent enough to warrant proper signaling over overlapped IO.

systemd integration is enabled.

主要言語
C++
スター
34.4k
フォーク
1.9k
平均マージ
1日 23時間
マージ済み PR(30日)
166

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/WSL のほかの issue

microsoft/WSL の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。