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

@ -13,52 +13,71 @@
const Main = imports.ui.main;
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const _Util = Me.imports.lib.util;
let _overrides;
let Me;
let opt;
let _firstRun = true;
function update(reset = false) {
opt = Me.imports.lib.settings.opt;
const moduleEnabled = opt.get('workspaceSwitcherPopupModule', true);
reset = reset || !moduleEnabled;
var WorkspaceSwitcherPopupModule = class {
constructor(me) {
Me = me;
opt = Me.opt;
// don't even touch this module if disabled
if (_firstRun && reset)
return;
this._firstActivation = true;
this.moduleEnabled = false;
this._overrides = null;
}
_firstRun = false;
if (_overrides)
_overrides.removeAll();
if (reset) {
_overrides = null;
cleanGlobals() {
Me = null;
opt = null;
return;
}
_overrides = new _Util.Overrides();
update(reset) {
this.moduleEnabled = opt.get('workspaceSwitcherPopupModule');
const conflict = Me.Util.getEnabledExtensions('workspace-switcher-manager').length ||
Me.Util.getEnabledExtensions('WsSwitcherPopupManager').length;
const enabled = global.settings.get_strv('enabled-extensions');
const allowWsPopupInjection = !(enabled.includes('workspace-switcher-manager@G-dH.github.com') || enabled.includes('WsSwitcherPopupManager@G-dH.github.com-dev'));
if (allowWsPopupInjection) { // 1-VERTICAL, 0-HORIZONTAL
_overrides.addOverride('WorkspaceSwitcherPopup', WorkspaceSwitcherPopup.WorkspaceSwitcherPopup.prototype, WorkspaceSwitcherPopupOverride);
if (conflict && !reset)
console.warn(`[${Me.metadata.name}] Warning: "WorkspaceSwitcherPopup" module disabled due to potential conflict with another extension`);
reset = reset || !this.moduleEnabled || conflict;
// don't touch 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(' WorkspaceSwitcherPopupModule - Keeping untouched');
}
}
const WorkspaceSwitcherPopupOverride = {
_activateModule() {
if (!this._overrides)
this._overrides = new Me.Util.Overrides();
this._overrides.addOverride('WorkspaceSwitcherPopup', WorkspaceSwitcherPopup.WorkspaceSwitcherPopup.prototype, WorkspaceSwitcherPopupCommon);
console.debug(' WorkspaceSwitcherPopupModule - Activated');
}
_disableModule() {
if (this._overrides)
this._overrides.removeAll();
this._overrides = null;
console.debug(' WorkspaceSwitcherPopupModule - Disabled');
}
};
const WorkspaceSwitcherPopupCommon = {
// injection to _init()
after__init() {
if (opt.ORIENTATION) { // 1-VERTICAL, 0-HORIZONTAL
this._list.vertical = true;
}
this._list.set_style('margin: 0;');
this.remove_constraint(this.get_constraints()[0]);
if (this.get_constraints()[0])
this.remove_constraint(this.get_constraints()[0]);
},
// injection to display()