Get working on Gnome 43

This commit is contained in:
Nathaniel van Diepen 2022-11-20 18:33:38 -07:00
parent 610e47e886
commit 4dd9ac58de
No known key found for this signature in database
GPG key ID: 87F4F19E784573DA
3 changed files with 10 additions and 11 deletions

View file

@ -4,7 +4,7 @@ const Panel = imports.ui.main.panel;
class BaTimeExtension { class BaTimeExtension {
constructor() { constructor() {
this.aggregateMenu = Panel.statusArea['quickSettings']; this.aggregateMenu = Panel.statusArea.quickSettings;
this.originalIndicator = this.aggregateMenu._system; this.originalIndicator = this.aggregateMenu._system;
this.customIndicator = new BaTime.imports.power.Indicator(); this.customIndicator = new BaTime.imports.power.Indicator();
this.aggregateMenu._indicators.replace_child( this.aggregateMenu._indicators.replace_child(

View file

@ -1,9 +1,7 @@
{ {
"shell-version": [ "shell-version": [
"40", "43"
"41",
"42"
], ],
"uuid": "batime@martin.zurowietz.de", "uuid": "batime@martin.zurowietz.de",
"url": "https://github.com/mzur/gnome-shell-batime", "url": "https://github.com/mzur/gnome-shell-batime",

View file

@ -1,20 +1,21 @@
const { GObject} = imports.gi; const { GObject} = imports.gi;
const UPower = imports.gi.UPowerGlib; const UPower = imports.gi.UPowerGlib;
const BaseIndicator = imports.ui.status.power.Indicator; const BaseIndicator = imports.ui.status.system.Indicator;
var Indicator = GObject.registerClass( var Indicator = GObject.registerClass(
class Indicator extends BaseIndicator { class Indicator extends BaseIndicator {
// Adapted from _getStatus of the parent. // Adapted from _getStatus of the parent.
_getTime() { _getTime() {
let seconds = 0; 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 ''; return '';
} else if (this._proxy.State === UPower.DeviceState.CHARGING) { } else if (proxy.State === UPower.DeviceState.CHARGING) {
seconds = this._proxy.TimeToFull; seconds = proxy.TimeToFull;
} else if (this._proxy.State === UPower.DeviceState.DISCHARGING) { } else if (proxy.State === UPower.DeviceState.DISCHARGING) {
seconds = this._proxy.TimeToEmpty; seconds = proxy.TimeToEmpty;
} else if (this._proxy.State === UPower.DeviceState.PENDING_CHARGE) { } else if (proxy.State === UPower.DeviceState.PENDING_CHARGE) {
return ''; return '';
} else { } else {
// state is PENDING_DISCHARGE or UNKNOWN // state is PENDING_DISCHARGE or UNKNOWN