diff --git a/batime@martin.zurowietz.de/extension.js b/batime@martin.zurowietz.de/extension.js index 053086b..6f92d8f 100644 --- a/batime@martin.zurowietz.de/extension.js +++ b/batime@martin.zurowietz.de/extension.js @@ -4,7 +4,7 @@ const Panel = imports.ui.main.panel; class BaTimeExtension { constructor() { - this.aggregateMenu = Panel.statusArea['quickSettings']; + this.aggregateMenu = Panel.statusArea.quickSettings; this.originalIndicator = this.aggregateMenu._system; this.customIndicator = new BaTime.imports.power.Indicator(); this.aggregateMenu._indicators.replace_child( diff --git a/batime@martin.zurowietz.de/metadata.json b/batime@martin.zurowietz.de/metadata.json index 1805cce..208d5b5 100644 --- a/batime@martin.zurowietz.de/metadata.json +++ b/batime@martin.zurowietz.de/metadata.json @@ -1,9 +1,7 @@ { "shell-version": [ - "40", - "41", - "42" + "43" ], "uuid": "batime@martin.zurowietz.de", "url": "https://github.com/mzur/gnome-shell-batime", diff --git a/batime@martin.zurowietz.de/power.js b/batime@martin.zurowietz.de/power.js index a16140a..d19d3df 100644 --- a/batime@martin.zurowietz.de/power.js +++ b/batime@martin.zurowietz.de/power.js @@ -1,20 +1,21 @@ const { GObject} = imports.gi; const UPower = imports.gi.UPowerGlib; -const BaseIndicator = imports.ui.status.power.Indicator; +const BaseIndicator = imports.ui.status.system.Indicator; var Indicator = GObject.registerClass( class Indicator extends BaseIndicator { // Adapted from _getStatus of the parent. _getTime() { let seconds = 0; + let proxy = this._systemItem.powerToggle._proxy; - if (this._proxy.State === UPower.DeviceState.FULLY_CHARGED) { + if (proxy.State === UPower.DeviceState.FULLY_CHARGED) { return ''; - } else if (this._proxy.State === UPower.DeviceState.CHARGING) { - seconds = this._proxy.TimeToFull; - } else if (this._proxy.State === UPower.DeviceState.DISCHARGING) { - seconds = this._proxy.TimeToEmpty; - } else if (this._proxy.State === UPower.DeviceState.PENDING_CHARGE) { + } else if (proxy.State === UPower.DeviceState.CHARGING) { + seconds = proxy.TimeToFull; + } else if (proxy.State === UPower.DeviceState.DISCHARGING) { + seconds = proxy.TimeToEmpty; + } else if (proxy.State === UPower.DeviceState.PENDING_CHARGE) { return ''; } else { // state is PENDING_DISCHARGE or UNKNOWN