Power the built-in panel down when the lid closes instead of leaving it lit - #2840
Open
dev-goalz wants to merge 1 commit into
Open
Power the built-in panel down when the lid closes instead of leaving it lit#2840dev-goalz wants to merge 1 commit into
dev-goalz wants to merge 1 commit into
Conversation
Member
|
The PR template is required. Please add it back and complete the checklist. |
Also keeps it dark when the last external output goes away with the lid shut. Written with assistance from Claude Opus 5.0. Reviewed, built and tested by the author, who understands the changes in full.
dev-goalz
force-pushed
the
fix/lid-panel-power
branch
from
September 9, 2026 17:22
0beaf4f to
cd14719
Compare
Author
Done |
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.
Close the lid on a laptop and the built-in panel can stay backlit inside it. It goes
dark only when the idle timeout expires, ten minutes by default. On one machine here
the panel was still lit almost four minutes after the lid shut.
This happens when the internal panel is the only enabled output.
should_handle_lidrequires two or more outputs, so with one the compositor releases its logind
inhibitor and ignores the lid entirely, and the lid switch handler is gated on
holding that inhibitor. logind policy then applies, and none of its options means
stay awake but blank. With
HandleLidSwitch=lockthe session locks and nothing everpowers the panel down.
The
>= 2guard is right as far as it goes. Disabling the only output would leavethe session with nowhere to render. But powering a connector down is not the same as
disabling an output. The connector can go dark while the output stays configured and
present, which is what this does. When no inhibitor is held, the lid switch now sets
DPMS on the internal output instead of being ignored.
One more change is needed for that to hold. Every input event powers all surfaces
back on, including the lid switch itself, so internal outputs are exempted while the
lid is shut. That needs the lid state on hand, so it is tracked as a field on
Commonand seeded from logind when outputs change, which also makes a compositorstarted with the lid already closed behave correctly.
The second patch covers the case where the lid is shut and the external display goes
away, for instance when a dock is unplugged. Re-enabling the internal connector at
that point is not optional, since it is the only output left and a session with none
has nowhere to render, but it must not light up inside a closed lid. It is powered
down instead, the same trade the single-output path makes.
The lid state is a plain field rather than a logind query on purpose. Asking the bus
from the output configuration path deadlocked an earlier version of this change and
hung the greeter, so that call is not made there.
How it was checked
Running on one laptop since 2026-08-31 across daily dock and lid cycles, with no
recurrence of either the lit panel or the greeter hang that the first version caused.
This is only visible when
HandleLidSwitchhas been changed from the defaultsuspend, since suspending blanks the panel as a side effect. That limits who runsinto it, but a panel inside a closed lid arguably should not be lit whatever logind
is configured to do.
Written with assistance from Claude Opus 5.0, as disclosed in the commit message.
The changes were reviewed, built and run on a daily driver for five and a half
weeks before submitting, and I can answer review comments on any of it.