Add notify_activity() call to prevent screen being left on#2148
Draft
diericx wants to merge 2 commits intopop-os:masterfrom
Draft
Add notify_activity() call to prevent screen being left on#2148diericx wants to merge 2 commits intopop-os:masterfrom
diericx wants to merge 2 commits intopop-os:masterfrom
Conversation
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.
Aims to resolve pop-os/cosmic-greeter#19
This was entirely diagnosed and written with Claude. I acknowledge that this has become problematic practice recently, but this is being done in good faith. I genuinely really want to use Cosmic but am blocked by this one bug: pop-os/cosmic-greeter#19. This change seems to have fixed my problem.
I see that there is a block against PRs written by agents due to review overhead, but this is a pretty small and targeted change. I hope we can use this to do some testing, open a conversation and help the devs diagnose. I can also see some ways that this might be problematic or inefficient, but I think the simplicity might make it easier for the devs to identify what is going on.
To test:
After testing over the past couple days this appears to have solved the issue for me.
Below this is all AI generated.
Root Cause
process_input_event() calls set_all_surfaces_dpms_on() for every input event, including non-user events like DeviceAdded/DeviceRemoved (triggered by Bluetooth reconnections, USB hub re-enumeration, etc.). These events don't call notify_activity() on the idle notifier. The ext_idle_notification_v1 protocol requires a "Resumed" event (from notify_activity()) before it can send "Idled" again — so the screen wakes up and the idle notifier gets stuck, unable to ever turn it back off.
Solution
Add a notify_activity() call alongside the existing blanket set_all_surfaces_dpms_on(), ensuring the idle timer is always reset when DPMS is woken. The screen may still briefly wake on phantom device events, but it will correctly go back to sleep after the idle timeout.