Get working on Gnome 43
This commit is contained in:
parent
610e47e886
commit
4dd9ac58de
3 changed files with 10 additions and 11 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
{
|
||||
"shell-version": [
|
||||
"40",
|
||||
"41",
|
||||
"42"
|
||||
"43"
|
||||
],
|
||||
"uuid": "batime@martin.zurowietz.de",
|
||||
"url": "https://github.com/mzur/gnome-shell-batime",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue