darkMode@linuxedo.com: Theme does not update after resuming from suspend (fix) #7820
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.
@linuxedo.com
This PR fixes an issue where the dark/light theme is not updated if the scheduled time for the change occurs while the computer is suspended or off.
Problem:
The applet uses a
Mainloop.timeout
to schedule the next theme change. If the system is suspended, this timer does not account for the elapsed time, and the theme change is missed upon resume.Solution:
This change adds a listener to the
org.freedesktop.login1
D-Bus service for thePrepareForSleep
signal. When the system resumes from sleep (PrepareForSleep
emitsfalse
), it triggers thechange_mode_automatically()
function, ensuring the correct theme is applied based on the current time.This makes the applet's automatic mode more reliable for users who frequently suspend their machines.