[gnome-shell] power: Fix icon when discharging at 100%
- From: verdre <jonasd src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] power: Fix icon when discharging at 100%
- Date: Tue, 26 May 2020 21:24:20 +0000 (UTC)
commit 4ae04d5aa8fda62c1654efe7f45296341106cc7e
Author: Florian Müllner <fmuellner gnome org>
Date: Tue May 26 21:26:22 2020 +0200
power: Fix icon when discharging at 100%
The special-case for a fill level of 100 introduced in commit 5fd52e99d39
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
js/ui/status/power.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index d8b7da9c71..0e8471fdfa 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -112,12 +112,12 @@ class Indicator extends PanelMenu.SystemIndicator {
let chargingState = this._proxy.State == UPower.DeviceState.CHARGING
? '-charging' : '';
let fillLevel = 10 * Math.floor(this._proxy.Percentage / 10);
- let icon;
- if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED ||
- fillLevel === 100)
- icon = 'battery-level-100-charged-symbolic';
- else
- icon = 'battery-level-%d%s-symbolic'.format(fillLevel, chargingState);
+ const charged =
+ this._proxy.State === UPower.DeviceState.FULLY_CHARGED ||
+ (this._proxy.State === UPower.DeviceState.CHARGING && fillLevel === 100);
+ const icon = charged
+ ? 'battery-level-100-charged-symbolic'
+ : 'battery-level-%d%s-symbolic'.format(fillLevel, chargingState);
// Make sure we fall back to fallback-icon-name and not GThemedIcon's
// default fallbacks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]