4 Commits
v9 ... v12

5 changed files with 63 additions and 40 deletions

View File

@@ -150,7 +150,7 @@ You can test it with command line :
gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.deleteGroups '{"groups":["new"]}'
Python examples is available
Python examples are available @ https://indefero.soutade.fr/p/genericmonitor/source/tree/master/examples
Development

View File

@@ -1,47 +1,47 @@
<interface name="com.soutade.GenericMonitor">
<!-- Functions -->
<method name="notify">
<arg type="s" direction="in" />
<arg name="parameters" type="s" direction="in" />
</method>
<method name="deleteItems">
<arg type="s" direction="in" />
<arg name="items" type="s" direction="in" />
</method>
<method name="deleteGroups">
<arg type="s" direction="in" />
<arg name="groups" type="s" direction="in" />
</method>
<method name="openPopup">
<arg type="s" direction="in" />
<arg name="popup" type="s" direction="in" />
</method>
<method name="closePopup">
<arg type="s" direction="in" />
<arg name="popup" type="s" direction="in" />
</method>
<method name="togglePopup">
<arg type="s" direction="in" />
<arg name="popup" type="s" direction="in" />
</method>
<!-- Events -->
<signal name="onClick">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onRightClick">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onDblClick">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onRightDblClick">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onScrollUp">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onScrollDown">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onEnter">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<signal name="onLeave">
<arg type="s" direction="out" />
<arg name="fullName" type="s" direction="out" />
</signal>
<!-- Activate/Deactivate signals -->
<signal name="onActivate">

View File

@@ -56,7 +56,7 @@ class PicturePopup(GenericMonitor):
popup = GenericMonitorPopup([url_widget, picture_widget])
signals = {
'on-click':'toggle-popup',
# Could also use this behavior
# Could also use this behavior [bugged since GNOME 42]
# 'on-enter':'open-popup',
# 'on-leave':'close-popup',
'on-dblclick':'signal',

View File

@@ -24,9 +24,9 @@
https://github.com/bananenfisch/RecentItems/blob/master/extension.js
https://github.com/julio641742/gnome-shell-extension-reference/blob/master/tutorials/POPUPMENU-EXTENSION.md
https://gjs-docs.gnome.org/st10~1.0_api/st.widget
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/js/ui/panelMenu.js
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/js/ui/popupMenu.js
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/js/ui/panel.js
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/panelMenu.js
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/panel.js
*/
const St = imports.gi.St;
@@ -56,16 +56,17 @@ function log(message) {
class SignalMgt {
constructor(item, name, group, dbus, menu) {
constructor(item, name, group, dbus, buttonMenu) {
this.name = name;
this.group = group;
this.fullname = this.name + '@' + this.group;
this.dbus = dbus;
this.menu = menu;
this.buttonMenu = buttonMenu;
this.signals = new WeakMap();
this.widgets = new Array();
this.timeouts = new Array();
this.menuOpen = false;
this.nbClicks = 0;
this.button = -1;
@@ -118,25 +119,42 @@ class SignalMgt {
this.signals.set(widget, null);
}
toggleMenu() {
if (this.menuOpen)
{
this.buttonMenu.menu.close();
this.menuOpen = false;
}
else
{
this.buttonMenu.menu.open(true);
this.menuOpen = true;
}
}
_manageEventAction(action, signalName) {
if (action === 'open-popup')
this.menu.open(true);
{
this.buttonMenu.menu.open(true);
this.menuOpen = true;
}
else if (action === 'close-popup')
this.menu.close();
{
this.buttonMenu.menu.close();
this.menuOpen = false;
}
else if (action === 'toggle-popup')
this.menu.toggle();
else if (action == 'delete')
{
this.toggleMenu();
}
else if (action === 'delete')
this.dbus.deleteItem(this, this.group);
else if (action === 'signal')
this.dbus.emitSignal(signalName, this.fullname);
return Clutter.EVENT_PROPAGATE;
return Clutter.EVENT_STOP;
}
_manageLeaveEvent() {
this._manageEventAction(this.onLeave);
}
_doClickCallback() {
let right = '';
let nbClicks = '';
@@ -229,7 +247,8 @@ class MonitorWidget extends PanelMenu.Button {
this.group = group;
this.fullname = this.name + '@' + this.group;
this.dbus = dbus;
this.signalManager = new SignalMgt(item, this.name, group, dbus, this.menu);
this.menuItem = null;
this.signalManager = new SignalMgt(item, this.name, group, dbus, this);
this.popup_signals = null;
this.popup_widgets = null;
@@ -414,7 +433,7 @@ class MonitorWidget extends PanelMenu.Button {
const name = hashGet(nestedItem, 'name', '');
this.popup_signals[widget] = new SignalMgt(nestedItem, name,
this.fullname, this.dbus,
this.menu);
this);
this.popup_signals[widget].connectWidgetSignals(widget);
this.popup_widgets.push(widget);
}
@@ -791,15 +810,19 @@ class Extension {
}
}
const extension = new Extension();
let extension = null;
function init() {
}
function enable() {
extension = new Extension();
extension.enable();
}
function disable() {
extension.disable();
if (extension) {
extension.disable();
extension = null;
}
}

View File

@@ -2,12 +2,12 @@
"uuid": "generic-monitor@gnome-shell-extensions",
"name": "Generic Monitor",
"description": "Display text & icon on systray using DBUS",
"version": "9",
"version": "12",
"shell-version": [
"41",
"40",
"3.38",
"3.36"
"43",
"42.3",
"42",
"41"
],
"url": "http://indefero.soutade.fr/p/genericmonitor"
}