1
0
Fork 0

Updating middleclickclose to version 1.9.1 [f1e773d].

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-24 19:41:14 +01:00
parent c4b6d4d646
commit 7037664800
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
3 changed files with 24 additions and 23 deletions

View file

@ -18,6 +18,6 @@ Otherwise you may
glib-compile-schemas $HOME/.local/share/gnome-shell/extensions/middleclickclose@paolo.tranquilli.gmail.com/schemas glib-compile-schemas $HOME/.local/share/gnome-shell/extensions/middleclickclose@paolo.tranquilli.gmail.com/schemas
``` ```
* reload gnome-shell (Alt-F2, r, Enter) * reload gnome-shell (Alt-F2, r, Enter) -> on Wayland you need to log out and log in again, there is no in-place reload
* activate it through Gnome Tweak Tool. * activate it through the Extensions gnome application.
![](tweak-tool-screenshot.png) ![](tweak-tool-screenshot.png)

View file

@ -27,24 +27,25 @@ const Workspace = imports.ui.workspace
const WindowPreview = imports.ui.windowPreview.WindowPreview const WindowPreview = imports.ui.windowPreview.WindowPreview
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const GObject = imports.gi.GObject;
const Me = ExtensionUtils.getCurrentExtension(); const Me = ExtensionUtils.getCurrentExtension();
var Init = class Init { var Init = class Init {
_connectSettings() { _connectSettings() {
this._settingsSignals = []; this._settingsSignals = [];
this._settingsSignals.push(this._settings.connect('changed::'+CLOSE_BUTTON, this._setCloseButton.bind(this))); this._settingsSignals.push(this._settings.connect('changed::'+CLOSE_BUTTON, this._setCloseButton.bind(this)));
this._settingsSignals.push(this._settings.connect('changed::'+REARRANGE_DELAY, this._setRearrangeDelay.bind(this))); this._settingsSignals.push(this._settings.connect('changed::'+REARRANGE_DELAY, this._setRearrangeDelay.bind(this)));
} }
_disconnectSettings() { _disconnectSettings() {
while(this._settingsSignals.length > 0) { while(this._settingsSignals.length > 0) {
this._settings.disconnect(this._settingsSignals.pop()); this._settings.disconnect(this._settingsSignals.pop());
} }
} }
_setCloseButton() { _setCloseButton() {
this._closeButton = this._settings.get_enum(CLOSE_BUTTON) + 1; this._closeButton = this._settings.get_enum(CLOSE_BUTTON) + 1;
} }
@ -53,8 +54,6 @@ var Init = class Init {
} }
enable() { enable() {
this._oldActivate = WindowPreview.prototype._activate;
this._oldDoRemoveWindow = Workspace.Workspace.prototype._doRemoveWindow;
this._oldAddWindowClone = Workspace.Workspace.prototype._addWindowClone; this._oldAddWindowClone = Workspace.Workspace.prototype._addWindowClone;
this._settings = ExtensionUtils.getSettings(); this._settings = ExtensionUtils.getSettings();
this._oldDelay = Workspace.WINDOW_REPOSITIONING_DELAY; this._oldDelay = Workspace.WINDOW_REPOSITIONING_DELAY;
@ -69,20 +68,27 @@ var Init = class Init {
if (action.get_button() == init._closeButton) { if (action.get_button() == init._closeButton) {
this._deleteAll(); this._deleteAll();
} else { } else {
init._oldActivate.apply(this); WindowPreview.prototype._activate.apply(this);
} }
}; };
// override _addWindowClone to add my event handler // override _addWindowClone to add my event handler
Workspace.Workspace.prototype._addWindowClone = function(metaWindow) { Workspace.Workspace.prototype._addWindowClone = function(metaWindow) {
let clone = init._oldAddWindowClone.apply(this, [metaWindow]); let clone = init._oldAddWindowClone.apply(this, [metaWindow]);
// remove default 'clicked' signal handler
let id = GObject.signal_handler_find(
clone.get_actions()[0],
{signalId: 'clicked'}
)
clone.get_actions()[0].disconnect(id);
// add custom 'clicked' signal handler
clone.get_actions()[0].connect('clicked', onClicked.bind(clone)); clone.get_actions()[0].connect('clicked', onClicked.bind(clone));
return clone; return clone;
} }
// override WindowClone's _activate
WindowPreview.prototype._activate = () => {};
// override Workspace's _doRemoveWindow in order to put into it the // override Workspace's _doRemoveWindow in order to put into it the
// parameteriseable rearrangement delay. Rather than copy the code from // parameteriseable rearrangement delay. Rather than copy the code from
// workspace.js, we reuse it but remove the scheduled rearrangement task // workspace.js, we reuse it but remove the scheduled rearrangement task
@ -93,8 +99,6 @@ var Init = class Init {
} }
disable() { disable() {
WindowPreview.prototype._activate = this._oldActivate;
Workspace.Workspace.prototype._doRemoveWindow = this._oldDoRemoveWindow;
Workspace.WINDOW_REPOSITIONING_DELAY = this._oldDelay; Workspace.WINDOW_REPOSITIONING_DELAY = this._oldDelay;
Workspace.Workspace.prototype._addWindowClone = this._oldAddWindowClone; Workspace.Workspace.prototype._addWindowClone = this._oldAddWindowClone;
this._disconnectSettings(); this._disconnectSettings();

View file

@ -1,8 +1,5 @@
{ {
"shell-version": [ "shell-version": ["42","43","44"],
"42",
"43"
],
"settings-schema": "org.gnome.shell.extensions.middleclickclose", "settings-schema": "org.gnome.shell.extensions.middleclickclose",
"gettext-domain": "org.gnome.shell.extensions.middleclickclose", "gettext-domain": "org.gnome.shell.extensions.middleclickclose",
"uuid": "middleclickclose@paolo.tranquilli.gmail.com", "uuid": "middleclickclose@paolo.tranquilli.gmail.com",