Skip to content

Commit

Permalink
Add support for GNOME 41
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Sep 26, 2021
1 parent 3602489 commit aab719d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion [email protected]/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

{
"shell-version": ["40"],
"shell-version": [
"40",
"41"
],
"uuid": "[email protected]",
"url": "https://github.com/mzur/gnome-shell-batime",
"settings-schema": "org.gnome.shell.extensions.batime",
Expand Down
14 changes: 7 additions & 7 deletions [email protected]/power.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hours>:<minutes>
return _("%d\u2236%02d").format(hours, minutes);
return _('%d\u2236%02d').format(hours, minutes);
}

_sync() {
Expand Down

0 comments on commit aab719d

Please sign in to comment.