From aab719dfc19cb18383bb4d554e922c02790c4830 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Sun, 26 Sep 2021 22:03:14 +0200 Subject: [PATCH] Add support for GNOME 41 --- batime@martin.zurowietz.de/metadata.json | 5 ++++- batime@martin.zurowietz.de/power.js | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/batime@martin.zurowietz.de/metadata.json b/batime@martin.zurowietz.de/metadata.json index 5de186a..b29552b 100644 --- a/batime@martin.zurowietz.de/metadata.json +++ b/batime@martin.zurowietz.de/metadata.json @@ -1,6 +1,9 @@ { - "shell-version": ["40"], + "shell-version": [ + "40", + "41" + ], "uuid": "batime@martin.zurowietz.de", "url": "https://github.com/mzur/gnome-shell-batime", "settings-schema": "org.gnome.shell.extensions.batime", diff --git a/batime@martin.zurowietz.de/power.js b/batime@martin.zurowietz.de/power.js index a6cd96f..b096a98 100644 --- a/batime@martin.zurowietz.de/power.js +++ b/batime@martin.zurowietz.de/power.js @@ -9,29 +9,29 @@ var Indicator = GObject.registerClass( _getTime() { let seconds = 0; - if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED) { + if (this._proxy.State === UPower.DeviceState.FULLY_CHARGED) { return ''; - } else if (this._proxy.State == UPower.DeviceState.CHARGING) { + } else if (this._proxy.State === UPower.DeviceState.CHARGING) { seconds = this._proxy.TimeToFull; - } else if (this._proxy.State == UPower.DeviceState.DISCHARGING) { + } else if (this._proxy.State === UPower.DeviceState.DISCHARGING) { seconds = this._proxy.TimeToEmpty; } else { // state is one of PENDING_CHARGING, PENDING_DISCHARGING - return _("Estimating…"); + return _('Estimating…'); } let time = Math.round(seconds / 60); - if (time == 0) { + if (time === 0) { // 0 is reported when UPower does not have enough data // to estimate battery life - return _("Estimating…"); + return _('Estimating…'); } let minutes = time % 60; let hours = Math.floor(time / 60); // Translators: this is : - return _("%d\u2236%02d").format(hours, minutes); + return _('%d\u2236%02d').format(hours, minutes); } _sync() {