From 6b1fe1dd2d1f52c31b692a89cc095baafe4c32a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 12 Nov 2020 10:42:11 +0100 Subject: [PATCH] Add openPopup(), closePopup() and togglePopup() functions to DBUS interface --- README.md | 2 ++ dbus.xml | 15 ++++++++++++ extension.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index db55fdc..a1465fa 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ extension emit one of the following signals : * onRightClick * onDblClick * onRightDblClick + * onEnter + * onLeave Other signals are available when extension is activated/deactivated : diff --git a/dbus.xml b/dbus.xml index 6cc828e..4819b05 100644 --- a/dbus.xml +++ b/dbus.xml @@ -9,6 +9,15 @@ + + + + + + + + + @@ -22,6 +31,12 @@ + + + + + + diff --git a/extension.js b/extension.js index e29bd51..56c5129 100644 --- a/extension.js +++ b/extension.js @@ -420,6 +420,18 @@ class MonitorWidget extends PanelMenu.Button { this.onLeave = hash_get(item, 'on-leave', this.onLeave); } + openPopup() { + this.menu.open(true); + } + + closePopup() { + this.menu.close(); + } + + togglePopup() { + this.menu.toggle(); + } + destroy() { this.menu.close(); super.destroy(); @@ -498,6 +510,17 @@ class GenericMonitorDBUS { return null; } + _getItemFromFullName(fullname) { + let splitName = fullname.split('@'); + if (splitName.length !== 2) { + log(`Invalid name ${item}`); + return null; + } + if (!this.monitor_groups.hasOwnProperty(splitName[1])) + return null; + return this._getItemFromGroup(this.monitor_groups[splitName[1]], splitName[0]); + } + _removeFromArray(array, value) { for(let i=0; i