diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-01-16 01:55:20 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-01-16 01:59:20 +1100 |
| commit | 33c1c694de3c214306f72c16f7581cd93886dc6b (patch) | |
| tree | c7e72db99b3b3f0682343131c8bbf0c6268ee655 /modules/bar/components/workspaces/OccupiedBg.qml | |
| parent | internal: no async loaders (diff) | |
| download | caelestia-shell-33c1c694de3c214306f72c16f7581cd93886dc6b.tar.gz caelestia-shell-33c1c694de3c214306f72c16f7581cd93886dc6b.tar.bz2 caelestia-shell-33c1c694de3c214306f72c16f7581cd93886dc6b.zip | |
internal: fix errors due to sync loaders
Diffstat (limited to 'modules/bar/components/workspaces/OccupiedBg.qml')
| -rw-r--r-- | modules/bar/components/workspaces/OccupiedBg.qml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml index 0364575..da6fa55 100644 --- a/modules/bar/components/workspaces/OccupiedBg.qml +++ b/modules/bar/components/workspaces/OccupiedBg.qml @@ -16,12 +16,15 @@ Item { property list<var> pills: [] onOccupiedChanged: { + if (!occupied) return; let count = 0; const start = groupOffset; const end = start + Config.bar.workspaces.shown; for (const [ws, occ] of Object.entries(occupied)) { if (ws > start && ws <= end && occ) { - if (!occupied[ws - 1]) { + const isFirstInGroup = Number(ws) === start + 1; + const isLastInGroup = Number(ws) === end; + if (isFirstInGroup || !occupied[ws - 1]) { if (pills[count]) pills[count].start = ws; else @@ -30,7 +33,7 @@ Item { })); count++; } - if (!occupied[ws + 1]) + if ((isLastInGroup || !occupied[ws + 1]) && pills[count - 1]) pills[count - 1].end = ws; } } @@ -48,8 +51,8 @@ Item { required property var modelData - readonly property Workspace start: root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null - readonly property Workspace end: root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null + readonly property Workspace start: root.workspaces.count > 0 ? root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null : null + readonly property Workspace end: root.workspaces.count > 0 ? root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null : null function getWsIdx(ws: int): int { let i = ws - 1; |