Emit D-Bus PropertiesChanged signal when battery charge state changes - #468
Open
abebinder wants to merge 1 commit into
Open
Emit D-Bus PropertiesChanged signal when battery charge state changes#468abebinder wants to merge 1 commit into
abebinder wants to merge 1 commit into
Conversation
abebinder
force-pushed
the
charging_fix
branch
from
August 22, 2026 18:23
12dbb6c to
a5ce593
Compare
abebinder
marked this pull request as ready for review
August 22, 2026 19:23
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.
TLDR
Fixes linuxmint/cinnamon#13686 by making it so the
PropertiesChangedD-Bus signal is emitted whenever the battery "state" changes which causes an immediate update to the power applet message.Before
We use
watch -n 1 cat /sys/class/power_supply/BAT0/statusto view the live state of the battery. When we plug in adapter, battery transitions to "not charging" and then quickly to "charging". the applet message transitions to "not charging" and will not update to "charging until the next percentage tick.2026-08-22.11-56-21.mp4
After
We use
watch -n 1 cat /sys/class/power_supply/BAT0/statusto view the live state of the battery. When we plug in adapter, battery state transitions to "not charging" and then quickly to "charging" and applet message mirrors these transitions.2026-08-22.11-53-15.mp4
Problem Description
When you plug in an adapter, for a brief moment the battery "state" will be "pending-charge" (as reported by upower) as the system decides if this adapter being plugged in should allow the battery to charge. This resolves to message "not charging" on the applet.
However, the battery state will usually quickly transition to "charging" once the system accepts the adapter as viable to allow the battery to charge. However, the message on the power applet will remain as "not charging" until the next percentage tick.
The reason for this is because the power applet message only gets updated when certain D-Bus properties change and a
PropertiesChangedsignal is emitted (viag_dbus_interface_skeleton_flush), and the properties previously only included "percentage" and "icon".The icon for "pending-charge" is the same as "charging" so a transition between pending-charge and charging does not result in an update to the applet. Thus it waits for percentage to tick up before changing.
Summary of Fix
We add the battery "state" as a D-Bus property and set it on the skeleton whenever it changes, then flush the skeleton which emits the
PropertiesChangedsignal. This triggers the power applet to refresh its display immediately.Companion PR in cinnamon: linuxmint/cinnamon#13945 (declares the new State property in the D-Bus interface XML)