4 Commits
v5 ... v9

3 changed files with 21 additions and 13 deletions

View File

@@ -7,6 +7,10 @@ This GNOME Shell Extension aims to display information to center box. Using DBUS
Installation Installation
------------ ------------
Install it from https://extensions.gnome.org/extension/2826/generic-monitor/
OR
Create a symbolic link from your _.local_ directory and enable extension Create a symbolic link from your _.local_ directory and enable extension
ln -s $PWD/generic-monitor@gnome-shell-extensions/ ~/.local/share/gnome-shell/extensions/ ln -s $PWD/generic-monitor@gnome-shell-extensions/ ~/.local/share/gnome-shell/extensions/
@@ -109,11 +113,11 @@ Signals can be :
Targets : Targets :
* signal : emit a signal to desktop application * signal : Emit a signal to desktop application
* delete : Delete item * delete : Delete item
* open-popup : Open the popup if there is one * open-popup : Open the popup if there is one
* close-popup : Close the popup if there is one * close-popup : Close the popup if there is one
* toggle-popup : Toggle (open/close) the popup if there is one * toggle-popup : Toggle (open/close) the popup if there is one
Signal names emit when action "signal" is specified : Signal names emit when action "signal" is specified :
@@ -142,7 +146,7 @@ Example
You can test it with command line : You can test it with command line :
gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.notify '{"group":"new","items":[{"name":"first","on-click":"toggle-popup","text":{"text":"Hello","style":"color:green"},"popup":{"items":[{"picture":{"path":"/tmp/cat2.jpg"}}]}}]}' gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.notify '{"group":"new","items":[{"name":"first","on-click":"toggle-popup","text":{"text":"Hello","style":"color:green"},"popup":{"items":[{"picture":{"path":"/tmp/cat.jpg"}}]}}]}'
gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.deleteGroups '{"groups":["new"]}' gdbus call --session --dest org.gnome.Shell --object-path /com/soutade/GenericMonitor --method com.soutade.GenericMonitor.deleteGroups '{"groups":["new"]}'

View File

@@ -31,7 +31,6 @@
const St = imports.gi.St; const St = imports.gi.St;
const Gio = imports.gi.Gio; const Gio = imports.gi.Gio;
const Lang = imports.lang;
const GLib = imports.gi.GLib const GLib = imports.gi.GLib
const Main = imports.ui.main; const Main = imports.ui.main;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
@@ -63,8 +62,9 @@ class SignalMgt {
this.fullname = this.name + '@' + this.group; this.fullname = this.name + '@' + this.group;
this.dbus = dbus; this.dbus = dbus;
this.menu = menu; this.menu = menu;
this.signals = new WeakMap(); this.signals = new WeakMap();
this.widgets = new Array(); this.widgets = new Array();
this.timeouts = new Array();
this.nbClicks = 0; this.nbClicks = 0;
this.button = -1; this.button = -1;
@@ -81,6 +81,8 @@ class SignalMgt {
destructor() { destructor() {
for(let widgetIdx in this.widgets) for(let widgetIdx in this.widgets)
this.disconnectWidgetSignals(this.widgets[widgetIdx]); this.disconnectWidgetSignals(this.widgets[widgetIdx]);
for(let timeoutIdx in this.timeouts)
GLib.Source.remove(this.timeouts[timeoutIdx]);
} }
updateSignals(item) { updateSignals(item) {
@@ -105,7 +107,7 @@ class SignalMgt {
id = widget.connect('scroll-event', this._onScroll.bind(this)); id = widget.connect('scroll-event', this._onScroll.bind(this));
array.push(id); array.push(id);
widget.set_reactive(true); widget.set_reactive(true);
id = widget.connect('button-release-event', Lang.bind(this, this._clicked)); id = widget.connect('button-release-event', this._clicked.bind(this));
array.push(id); array.push(id);
} }
@@ -169,8 +171,9 @@ class SignalMgt {
this.button = event.get_button(); this.button = event.get_button();
this.nbClicks = 1; this.nbClicks = 1;
Mainloop.timeout_add(this.dbus.ClutterSettings['double-click-time'], let sourceId = Mainloop.timeout_add(this.dbus.ClutterSettings['double-click-time'],
Lang.bind(this, this._doClickCallback)); this._doClickCallback.bind(this));
this.timeouts.push(sourceId);
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;

View File

@@ -2,8 +2,9 @@
"uuid": "generic-monitor@gnome-shell-extensions", "uuid": "generic-monitor@gnome-shell-extensions",
"name": "Generic Monitor", "name": "Generic Monitor",
"description": "Display text & icon on systray using DBUS", "description": "Display text & icon on systray using DBUS",
"version": "5", "version": "9",
"shell-version": [ "shell-version": [
"41",
"40", "40",
"3.38", "3.38",
"3.36" "3.36"