summaryrefslogtreecommitdiff
path: root/modules/bar/components/workspaces/OccupiedBg.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-24 15:46:15 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-24 15:46:15 +1000
commit92efbc61f72923304b92057d16760cd4d29dc67f (patch)
tree0f12ffe26475bfb50019708d2eeb533d045d8289 /modules/bar/components/workspaces/OccupiedBg.qml
parenthypr: proper kb layout code (diff)
downloadcaelestia-shell-92efbc61f72923304b92057d16760cd4d29dc67f.tar.gz
caelestia-shell-92efbc61f72923304b92057d16760cd4d29dc67f.tar.bz2
caelestia-shell-92efbc61f72923304b92057d16760cd4d29dc67f.zip
bar: better handling for named workspaces
Fixes #448
Diffstat (limited to 'modules/bar/components/workspaces/OccupiedBg.qml')
-rw-r--r--modules/bar/components/workspaces/OccupiedBg.qml11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml
index 37fe4c1..5e1c966 100644
--- a/modules/bar/components/workspaces/OccupiedBg.qml
+++ b/modules/bar/components/workspaces/OccupiedBg.qml
@@ -48,8 +48,15 @@ Item {
required property var modelData
- readonly property Workspace start: root.workspaces.itemAt((modelData.start - 1) % Config.bar.workspaces.shown) ?? null
- readonly property Workspace end: root.workspaces.itemAt((modelData.end - 1) % Config.bar.workspaces.shown) ?? null
+ readonly property Workspace start: root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null
+ readonly property Workspace end: root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null
+
+ function getWsIdx(ws: int): int {
+ let i = ws - 1;
+ while (i < 0)
+ i += Config.bar.workspaces.shown;
+ return i % Config.bar.workspaces.shown;
+ }
anchors.horizontalCenter: root.horizontalCenter