From 9943a9075fd3488e7fdb5f3ecd23298f03e92681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 31 Jan 2021 20:18:11 +0100 Subject: [PATCH] Popup text must be labels not buttons --- extension.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 2598f2c..73b485f 100644 --- a/extension.js +++ b/extension.js @@ -388,7 +388,7 @@ class MonitorWidget extends PanelMenu.Button { let nestedItem = null; if (widgetDict.hasOwnProperty('text')) { nestedItem = widgetDict['text']; - widget = this._createText(nestedItem); + widget = this._createLabel(nestedItem); } else if (widgetDict.hasOwnProperty('picture')) { nestedItem = widgetDict['picture']; widget = this._createPicture(nestedItem); @@ -426,7 +426,7 @@ class MonitorWidget extends PanelMenu.Button { return this._createText(itemValues); } - _createText(item) { + __createText(item, isLabel) { if (!item.hasOwnProperty('text')) { log('Text must have a \'text\' value'); return null; @@ -439,13 +439,25 @@ class MonitorWidget extends PanelMenu.Button { if (item['text'] === '') { return null; } else { - const widget = new St.Button({ label: item['text'] }); + let widget = null; + if (isLabel) + widget = new St.Label({ text: item['text'] }); + else + widget = new St.Button({ label: item['text'] }); widget.set_style(style); return widget; } } + _createText(item) { + return this.__createText(item, false); + } + + _createLabel(item) { + return this.__createText(item, true); + } + _createIconOld(item) { var itemValues = {}; itemValues = { 'path':item['icon'] };