status/power: Always show real percentage in battery label

We currently display the percentage as "100%" if the battery state is
"fully charged", but the actual capacity may be lower than that.

Just show the real percentage, which is consistent with Settings.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3393

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1787>
This commit is contained in:
Prajna Sariputra 2021-04-01 20:20:29 +11:00 committed by Florian Müllner
parent 1cefd589da
commit 6ee2c4f74c

View File

@ -134,11 +134,7 @@ class Indicator extends PanelMenu.SystemIndicator {
this._item.icon.fallback_icon_name = fallbackIcon; this._item.icon.fallback_icon_name = fallbackIcon;
// The icon label // The icon label
let label; const label = _('%d\u2009%%').format(this._proxy.Percentage);
if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED)
label = _("%d\u2009%%").format(100);
else
label = _("%d\u2009%%").format(this._proxy.Percentage);
this._percentageLabel.text = label; this._percentageLabel.text = label;
// The status label // The status label