power: Handle "100% but charging" case
I've observed that UPower can occasionally report a charge level of 100% while the state is still "charging". This usually doesn't last very long but it is noticeable because the power icon changes to a "missing icon" icon. This will handle that rare case correctly. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/814
This commit is contained in:
parent
fd5989e99a
commit
5fd52e99d3
@ -112,9 +112,12 @@ class Indicator extends PanelMenu.SystemIndicator {
|
|||||||
let chargingState = this._proxy.State == UPower.DeviceState.CHARGING
|
let chargingState = this._proxy.State == UPower.DeviceState.CHARGING
|
||||||
? '-charging' : '';
|
? '-charging' : '';
|
||||||
let fillLevel = 10 * Math.floor(this._proxy.Percentage / 10);
|
let fillLevel = 10 * Math.floor(this._proxy.Percentage / 10);
|
||||||
let icon = this._proxy.State == UPower.DeviceState.FULLY_CHARGED
|
let icon;
|
||||||
? 'battery-level-100-charged-symbolic'
|
if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED ||
|
||||||
: `battery-level-${fillLevel}${chargingState}-symbolic`;
|
fillLevel === 100)
|
||||||
|
icon = 'battery-level-100-charged-symbolic';
|
||||||
|
else
|
||||||
|
icon = `battery-level-${fillLevel}${chargingState}-symbolic`;
|
||||||
|
|
||||||
// Make sure we fall back to fallback-icon-name and not GThemedIcon's
|
// Make sure we fall back to fallback-icon-name and not GThemedIcon's
|
||||||
// default fallbacks
|
// default fallbacks
|
||||||
|
Loading…
Reference in New Issue
Block a user