Updates for GNOME 43
This commit is contained in:
parent
d3665f2ff0
commit
4c73986596
|
@ -56,7 +56,7 @@ class PicturePopup(GenericMonitor):
|
||||||
popup = GenericMonitorPopup([url_widget, picture_widget])
|
popup = GenericMonitorPopup([url_widget, picture_widget])
|
||||||
signals = {
|
signals = {
|
||||||
'on-click':'toggle-popup',
|
'on-click':'toggle-popup',
|
||||||
# Could also use this behavior
|
# Could also use this behavior [bugged since GNOME 42]
|
||||||
# 'on-enter':'open-popup',
|
# 'on-enter':'open-popup',
|
||||||
# 'on-leave':'close-popup',
|
# 'on-leave':'close-popup',
|
||||||
'on-dblclick':'signal',
|
'on-dblclick':'signal',
|
||||||
|
|
61
extension.js
61
extension.js
|
@ -24,9 +24,9 @@
|
||||||
https://github.com/bananenfisch/RecentItems/blob/master/extension.js
|
https://github.com/bananenfisch/RecentItems/blob/master/extension.js
|
||||||
https://github.com/julio641742/gnome-shell-extension-reference/blob/master/tutorials/POPUPMENU-EXTENSION.md
|
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://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/main/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/main/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/panel.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
@ -56,16 +56,17 @@ function log(message) {
|
||||||
|
|
||||||
class SignalMgt {
|
class SignalMgt {
|
||||||
|
|
||||||
constructor(item, name, group, dbus, menu) {
|
constructor(item, name, group, dbus, buttonMenu) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.fullname = this.name + '@' + this.group;
|
this.fullname = this.name + '@' + this.group;
|
||||||
this.dbus = dbus;
|
this.dbus = dbus;
|
||||||
this.menu = menu;
|
this.buttonMenu = buttonMenu;
|
||||||
this.signals = new WeakMap();
|
this.signals = new WeakMap();
|
||||||
this.widgets = new Array();
|
this.widgets = new Array();
|
||||||
this.timeouts = new Array();
|
this.timeouts = new Array();
|
||||||
|
|
||||||
|
this.menuOpen = false;
|
||||||
this.nbClicks = 0;
|
this.nbClicks = 0;
|
||||||
this.button = -1;
|
this.button = -1;
|
||||||
|
|
||||||
|
@ -118,25 +119,42 @@ class SignalMgt {
|
||||||
this.signals.set(widget, null);
|
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) {
|
_manageEventAction(action, signalName) {
|
||||||
if (action === 'open-popup')
|
if (action === 'open-popup')
|
||||||
this.menu.open(true);
|
{
|
||||||
|
this.buttonMenu.menu.open(true);
|
||||||
|
this.menuOpen = true;
|
||||||
|
}
|
||||||
else if (action === 'close-popup')
|
else if (action === 'close-popup')
|
||||||
this.menu.close();
|
{
|
||||||
|
this.buttonMenu.menu.close();
|
||||||
|
this.menuOpen = false;
|
||||||
|
}
|
||||||
else if (action === 'toggle-popup')
|
else if (action === 'toggle-popup')
|
||||||
this.menu.toggle();
|
{
|
||||||
else if (action == 'delete')
|
this.toggleMenu();
|
||||||
|
}
|
||||||
|
else if (action === 'delete')
|
||||||
this.dbus.deleteItem(this, this.group);
|
this.dbus.deleteItem(this, this.group);
|
||||||
else if (action === 'signal')
|
else if (action === 'signal')
|
||||||
this.dbus.emitSignal(signalName, this.fullname);
|
this.dbus.emitSignal(signalName, this.fullname);
|
||||||
|
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
_manageLeaveEvent() {
|
|
||||||
this._manageEventAction(this.onLeave);
|
|
||||||
}
|
|
||||||
|
|
||||||
_doClickCallback() {
|
_doClickCallback() {
|
||||||
let right = '';
|
let right = '';
|
||||||
let nbClicks = '';
|
let nbClicks = '';
|
||||||
|
@ -229,7 +247,8 @@ class MonitorWidget extends PanelMenu.Button {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.fullname = this.name + '@' + this.group;
|
this.fullname = this.name + '@' + this.group;
|
||||||
this.dbus = dbus;
|
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_signals = null;
|
||||||
this.popup_widgets = null;
|
this.popup_widgets = null;
|
||||||
|
|
||||||
|
@ -414,7 +433,7 @@ class MonitorWidget extends PanelMenu.Button {
|
||||||
const name = hashGet(nestedItem, 'name', '');
|
const name = hashGet(nestedItem, 'name', '');
|
||||||
this.popup_signals[widget] = new SignalMgt(nestedItem, name,
|
this.popup_signals[widget] = new SignalMgt(nestedItem, name,
|
||||||
this.fullname, this.dbus,
|
this.fullname, this.dbus,
|
||||||
this.menu);
|
this);
|
||||||
this.popup_signals[widget].connectWidgetSignals(widget);
|
this.popup_signals[widget].connectWidgetSignals(widget);
|
||||||
this.popup_widgets.push(widget);
|
this.popup_widgets.push(widget);
|
||||||
}
|
}
|
||||||
|
@ -791,15 +810,19 @@ class Extension {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const extension = new Extension();
|
let extension = null;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable() {
|
function enable() {
|
||||||
|
extension = new Extension();
|
||||||
extension.enable();
|
extension.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
function disable() {
|
function disable() {
|
||||||
extension.disable();
|
if (extension) {
|
||||||
|
extension.disable();
|
||||||
|
extension = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
"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": "10",
|
"version": "11",
|
||||||
"shell-version": [
|
"shell-version": [
|
||||||
"42",
|
"43",
|
||||||
"41",
|
"42.3",
|
||||||
"40",
|
"42",
|
||||||
"3.38",
|
"41"
|
||||||
"3.36"
|
|
||||||
],
|
],
|
||||||
"url": "http://indefero.soutade.fr/p/genericmonitor"
|
"url": "http://indefero.soutade.fr/p/genericmonitor"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user