Skip to content

Commit

Permalink
extension: Remove outdated Panel import
Browse files Browse the repository at this point in the history
The panel module no longer exports all of its constants, so we need to
define what we need ourselves.

And actually, Panel.PANEL_ITEM_IMPLEMENTATIONS.battery was removed from
Gnome Shell 10 years ago in [1], so that has apparently been broken for a
while...

Fixes #41

[1] https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/5c8c4e0aad4c1e2d05960efdfded7c69225e2d95
  • Loading branch information
mgalgs committed Nov 3, 2023
1 parent 36c5c6c commit 0f042e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions system-monitor-next@paradoxxx.zero.gmail.com/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ import * as ModalDialog from "resource:///org/gnome/shell/ui/modalDialog.js";
import * as ExtensionSystem from "resource:///org/gnome/shell/ui/extensionSystem.js";

import * as Main from "resource:///org/gnome/shell/ui/main.js";
import * as Panel from "resource:///org/gnome/shell/ui/panel.js";
import * as PanelMenu from "resource:///org/gnome/shell/ui/panelMenu.js";
import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js";

import * as Util from "resource:///org/gnome/shell/misc/util.js";

const NetworkManager = NM;
const UPower = UPowerGlib;
// Copied as of https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/5fa08fe53376f5dca755360bd005a4a51ca78917/js/ui/panel.js#L45
const PANEL_ICON_SIZE = 16;

let smDepsGtop = true;
let smDepsNM = true;
Expand Down Expand Up @@ -1154,8 +1155,10 @@ const Battery = class SystemMonitor_Battery extends ElementBase {
this.icon_hidden = true;
}
} else if (this.icon_hidden) {
let Indicator = new Panel.PANEL_ITEM_IMPLEMENTATIONS.battery();
Main.panel.addToStatusArea('battery', Indicator, Main.sessionMode.panel.right.indexOf('battery'), 'right');
// TODO: Figure out what to put here instead
// (git blame for more info)
// let Indicator = new Panel.PANEL_ITEM_IMPLEMENTATIONS.battery();
// Main.panel.addToStatusArea('battery', Indicator, Main.sessionMode.panel.right.indexOf('battery'), 'right');
this.icon_hidden = false;
// Main.panel._updatePanel('right');
}
Expand Down Expand Up @@ -2358,7 +2361,7 @@ export default class SystemMonitorExtension extends Extension {
this._Locale = this._Locale.split('_')[0];
}

this._IconSize = Math.round(Panel.PANEL_ICON_SIZE * 4 / 5);
this._IconSize = Math.round(PANEL_ICON_SIZE * 4 / 5);

this._Schema = this.getSettings();

Expand Down

0 comments on commit 0f042e8

Please sign in to comment.