From 0f042e8cfd67c0891c6b5917d9fd5a8de7219d8a Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Thu, 2 Nov 2023 21:05:35 -0700 Subject: [PATCH] extension: Remove outdated Panel import 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 --- .../extension.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/system-monitor-next@paradoxxx.zero.gmail.com/extension.js b/system-monitor-next@paradoxxx.zero.gmail.com/extension.js index 1fd71e60..d314f152 100644 --- a/system-monitor-next@paradoxxx.zero.gmail.com/extension.js +++ b/system-monitor-next@paradoxxx.zero.gmail.com/extension.js @@ -36,7 +36,6 @@ 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"; @@ -44,6 +43,8 @@ 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; @@ -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'); } @@ -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();