power: Fix icon when discharging at 100%

The special-case for a fill level of 100 introduced in commit 5fd52e99d3
should only apply when charging, for the discharging state there's a
proper battery-level-100-symbolic icon.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2286
This commit is contained in:
Florian Müllner 2020-05-26 21:26:22 +02:00
parent 5d5ca80d17
commit 4ae04d5aa8

View File

@ -112,12 +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; const charged =
if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED || this._proxy.State === UPower.DeviceState.FULLY_CHARGED ||
fillLevel === 100) (this._proxy.State === UPower.DeviceState.CHARGING && fillLevel === 100);
icon = 'battery-level-100-charged-symbolic'; const icon = charged
else ? 'battery-level-100-charged-symbolic'
icon = 'battery-level-%d%s-symbolic'.format(fillLevel, chargingState); : 'battery-level-%d%s-symbolic'.format(fillLevel, chargingState);
// 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