diff --git a/devices/wim/config/ags/config.js b/devices/wim/config/ags/config.js index 628070e..64d858c 100644 --- a/devices/wim/config/ags/config.js +++ b/devices/wim/config/ags/config.js @@ -1,3 +1,6 @@ +// Has to be a traditional function for 'this' scope +Array.prototype.remove = function (el) { this.splice(this.indexOf(el), 1); }; + import { App, Utils } from './imports.js'; import closeAll from './js/misc/closer.js'; diff --git a/devices/wim/config/ags/js/overview/clients.js b/devices/wim/config/ags/js/overview/clients.js index af3dd9a..b0a97cc 100644 --- a/devices/wim/config/ags/js/overview/clients.js +++ b/devices/wim/config/ags/js/overview/clients.js @@ -5,9 +5,6 @@ const { execAsync } = Utils; import { WindowButton } from './dragndrop.js'; import * as VARS from './variables.js'; -// Has to be a traditional function for 'this' scope -Array.prototype.remove = function (el) { this.splice(this.indexOf(el), 1); }; - const scale = size => size * VARS.SCALE - VARS.MARGIN; const getFontSize = client => Math.min(scale(client.size[0]), scale(client.size[1])) * VARS.ICON_SCALE; diff --git a/devices/wim/config/ags/js/overview/workspaces.js b/devices/wim/config/ags/js/overview/workspaces.js index fc92009..37216b4 100644 --- a/devices/wim/config/ags/js/overview/workspaces.js +++ b/devices/wim/config/ags/js/overview/workspaces.js @@ -74,7 +74,10 @@ const Workspace = (id, name, extra = false) => { ['wasActive', false], ], connections: [[Hyprland, box => { - box._timeouts.forEach(timer => GLib.source_remove(timer)); + box._timeouts.forEach(timer => { + GLib.source_remove(timer); + box._timeouts.remove(timer); + }); const activeId = Hyprland.active.workspace.id; const active = activeId === box._id; @@ -84,15 +87,21 @@ const Workspace = (id, name, extra = false) => { if (Hyprland.getWorkspace(box._id)?.windows > 0 || active) { rev.setStyle(DEFAULT_STYLE); - box._timeouts.push(Utils.timeout(100, () => { + + const timer = Utils.timeout(100, () => { box.revealChild = true; - })); + box._timeouts.remove(timer); + }); + box._timeouts.push(timer); } else if (!Hyprland.getWorkspace(box._id)?.windows > 0) { rev.setStyle(DEFAULT_STYLE); - box._timeouts.push(Utils.timeout(100, () => { + + const timer = Utils.timeout(100, () => { box.revealChild = false; - })); + box._timeouts.remove(timer); + }); + box._timeouts.push(timer); return; } @@ -103,18 +112,23 @@ const Workspace = (id, name, extra = false) => { box._wasActive = true; } else if (box._wasActive) { - box._timeouts.push(Utils.timeout(120, () => { + const timer1 = Utils.timeout(120, () => { rev.setStyle(`${DEFAULT_STYLE} transition: margin 0.5s ease-in-out; opacity: 1; margin-left: ${n ? '' : '-'}300px; margin-right: ${n ? '-' : ''}300px;`); box._wasActive = false; - })); - box._timeouts.push(Utils.timeout(500, () => { + box._timeouts.remove(timer1); + }); + box._timeouts.push(timer1); + + const timer2 = Utils.timeout(500, () => { rev.setStyle(`${DEFAULT_STYLE} opacity: 0; margin-left: ${n ? '' : '-'}300px; margin-right: ${n ? '-' : ''}300px;`); - })); + box._timeouts.remove(timer2); + }); + box._timeouts.push(timer2); } else { rev.setStyle(`${DEFAULT_STYLE} opacity: 0;