1
0
Fork 0

Updating 44/vertical-workspaces to version 37+20231208 [0d82192].

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-24 19:42:07 +01:00
parent 975b88c6bb
commit 07381ac119
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
37 changed files with 9559 additions and 4338 deletions

View file

@ -10,79 +10,104 @@
'use strict';
const { Clutter } = imports.gi;
const Clutter = imports.gi.Clutter;
const Main = imports.ui.main;
const OsdWindow = imports.ui.osdWindow;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const _Util = Me.imports.lib.util;
const OsdPositions = {
1: {
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.START,
},
2: {
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.START,
},
3: {
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.START,
},
4: {
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER,
},
5: {
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.END,
},
6: {
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.END,
},
7: {
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.END,
},
};
let _overrides;
let Me;
let opt;
let _firstRun = true;
function update(reset = false) {
opt = Me.imports.lib.settings.opt;
const moduleEnabled = opt.get('osdWindowModule', true);
reset = reset || !moduleEnabled;
let OsdPositions;
// don't even touch this module if disabled
if (_firstRun && reset)
return;
var OsdWindowModule = class {
constructor(me) {
Me = me;
opt = Me.opt;
_firstRun = false;
this._firstActivation = true;
this.moduleEnabled = false;
this._overrides = null;
if (_overrides)
_overrides.removeAll();
if (reset || !moduleEnabled) {
updateExistingOsdWindows(6);
_overrides = null;
opt = null;
return;
OsdPositions = {
1: {
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.START,
},
2: {
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.START,
},
3: {
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.START,
},
4: {
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER,
},
5: {
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.END,
},
6: {
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.END,
},
7: {
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.END,
},
};
}
_overrides = new _Util.Overrides();
_overrides.addOverride('osdWindow', OsdWindow.OsdWindow.prototype, OsdWindowCommon);
}
cleanGlobals() {
Me = null;
opt = null;
OsdPositions = null;
}
function updateExistingOsdWindows(position) {
position = position ? position : opt.OSD_POSITION;
Main.osdWindowManager._osdWindows.forEach(osd => {
osd.set(OsdPositions[position]);
});
}
update(reset) {
this.moduleEnabled = opt.get('osdWindowModule');
const conflict = false;
reset = reset || !this.moduleEnabled || conflict;
// don't touch the original code if module disabled
if (reset && !this._firstActivation) {
this._disableModule();
} else if (!reset) {
this._firstActivation = false;
this._activateModule();
}
if (reset && this._firstActivation)
console.debug(' OsdWindowModule - Keeping untouched');
}
_activateModule() {
if (!this._overrides)
this._overrides = new Me.Util.Overrides();
this._overrides.addOverride('osdWindow', OsdWindow.OsdWindow.prototype, OsdWindowCommon);
console.debug(' OsdWindowModule - Activated');
}
_disableModule() {
if (this._overrides)
this._overrides.removeAll();
this._overrides = null;
this._updateExistingOsdWindows(6);
console.debug(' WorkspaceSwitcherPopupModule - Disabled');
}
_updateExistingOsdWindows(position) {
position = position ? position : opt.OSD_POSITION;
Main.osdWindowManager._osdWindows.forEach(osd => {
osd.set(OsdPositions[position]);
});
}
};
const OsdWindowCommon = {
after_show() {