Skip to content

Add notify_activity() call to prevent screen being left on#2148

Draft
diericx wants to merge 2 commits intopop-os:masterfrom
diericx:greeter-19
Draft

Add notify_activity() call to prevent screen being left on#2148
diericx wants to merge 2 commits intopop-os:masterfrom
diericx:greeter-19

Conversation

@diericx
Copy link

@diericx diericx commented Mar 1, 2026

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:

git clone [email protected]:diericx/cosmic-comp.git
cd cosmic-comp
git checkout greeter-19
cargo clean && make
sudo rm /usr/bin/cosmic-comp && sudo cp ./target/release/cosmic-comp /usr/bin/cosmic-comp

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.


  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.

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.

Bug: Displays don't always go into standby mode when the machine is locked

1 participant