power: Ceil percentage when looking for icon

Use correct battery icon. For example, use battery-level-10-symbolic, with
a warning, on 1%-10% instead of 10%-19%.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1617

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/726
This commit is contained in:
Alexander Mikhaylenko 2019-09-14 12:10:40 +05:00
parent 314a89a837
commit 35aa7998bc

View File

@ -110,7 +110,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
// The icons
let chargingState = this._proxy.State == UPower.DeviceState.CHARGING
? '-charging' : '';
let fillLevel = 10 * Math.floor(this._proxy.Percentage / 10);
let fillLevel = 10 * Math.ceil(this._proxy.Percentage / 10);
let icon = this._proxy.State == UPower.DeviceState.FULLY_CHARGED
? 'battery-level-100-charged-symbolic'
: `battery-level-${fillLevel}${chargingState}-symbolic`;