diff options
| author | Freya Murphy <freya@freyacat.org> | 2026-01-12 12:47:22 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2026-01-12 12:47:22 -0500 |
| commit | 1a4cb7a87a6bccd0d9a2e769139cd86f5de53e8a (patch) | |
| tree | 9169031f3b18be961f07b99276d1b3e59d0b52f0 /modules/bar/components/workspaces/ActiveIndicator.qml | |
| parent | remove default paths (diff) | |
| download | caelestia-shell-1a4cb7a87a6bccd0d9a2e769139cd86f5de53e8a.tar.gz caelestia-shell-1a4cb7a87a6bccd0d9a2e769139cd86f5de53e8a.tar.bz2 caelestia-shell-1a4cb7a87a6bccd0d9a2e769139cd86f5de53e8a.zip | |
refactor workspace functionality (real per monitor workspaces)
Diffstat (limited to 'modules/bar/components/workspaces/ActiveIndicator.qml')
| -rw-r--r-- | modules/bar/components/workspaces/ActiveIndicator.qml | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/modules/bar/components/workspaces/ActiveIndicator.qml b/modules/bar/components/workspaces/ActiveIndicator.qml index 3e265e2..912f771 100644 --- a/modules/bar/components/workspaces/ActiveIndicator.qml +++ b/modules/bar/components/workspaces/ActiveIndicator.qml @@ -10,27 +10,20 @@ StyledRect { required property int activeWsId required property Repeater workspaces required property Item mask + required property var monitorWorkspaces readonly property int currentWsIdx: { - let i = activeWsId - 1; - while (i < 0) - i += Config.bar.workspaces.shown; - return i % Config.bar.workspaces.shown; + let wss = monitorWorkspaces; + for (let i = 0; i < wss.length; i++) { + let ws = wss[i]; + if (ws.id == activeWsId) + return i; + } } - property real leading: workspaces.itemAt(currentWsIdx)?.y ?? 0 - property real trailing: workspaces.itemAt(currentWsIdx)?.y ?? 0 property real currentSize: workspaces.itemAt(currentWsIdx)?.size ?? 0 - property real offset: Math.min(leading, trailing) - property real size: { - const s = Math.abs(leading - trailing) + currentSize; - if (Config.bar.workspaces.activeTrail && lastWs > currentWsIdx) { - const ws = workspaces.itemAt(lastWs); - // console.log(ws, lastWs); - return ws ? Math.min(ws.y + ws.size - offset, s) : 0; - } - return s; - } + property real offset: workspaces.itemAt(currentWsIdx)?.y ?? 0 + property real size: Config.bar.sizes.innerWidth - Appearance.padding.small * 2 property int cWs property int lastWs @@ -42,7 +35,7 @@ StyledRect { clip: true y: offset + mask.y - implicitWidth: Config.bar.sizes.innerWidth - Appearance.padding.small * 2 + implicitWidth: size implicitHeight: size radius: Appearance.rounding.full color: Colours.palette.m3primary @@ -60,35 +53,7 @@ StyledRect { anchors.horizontalCenter: parent.horizontalCenter } - Behavior on leading { - enabled: Config.bar.workspaces.activeTrail - - EAnim {} - } - - Behavior on trailing { - enabled: Config.bar.workspaces.activeTrail - - EAnim { - duration: Appearance.anim.durations.normal * 2 - } - } - - Behavior on currentSize { - enabled: Config.bar.workspaces.activeTrail - - EAnim {} - } - Behavior on offset { - enabled: !Config.bar.workspaces.activeTrail - - EAnim {} - } - - Behavior on size { - enabled: !Config.bar.workspaces.activeTrail - EAnim {} } |