diff options
| author | Freya Murphy <freya@freyacat.org> | 2026-01-12 12:47:22 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2026-01-22 08:36:42 -0500 |
| commit | e16a918db744c538fc69a3a463609780f9b0ea89 (patch) | |
| tree | af2637c92922cbb9920f79a0e823e6ae3952f425 /modules/bar/components/workspaces/ActiveIndicator.qml | |
| parent | remove default paths (diff) | |
| download | caelestia-shell-e16a918db744c538fc69a3a463609780f9b0ea89.tar.gz caelestia-shell-e16a918db744c538fc69a3a463609780f9b0ea89.tar.bz2 caelestia-shell-e16a918db744c538fc69a3a463609780f9b0ea89.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 | 57 |
1 files changed, 11 insertions, 46 deletions
diff --git a/modules/bar/components/workspaces/ActiveIndicator.qml b/modules/bar/components/workspaces/ActiveIndicator.qml index dae54b3..912f771 100644 --- a/modules/bar/components/workspaces/ActiveIndicator.qml +++ b/modules/bar/components/workspaces/ActiveIndicator.qml @@ -10,28 +10,21 @@ 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; - } - - property real leading: workspaces.count > 0 ? workspaces.itemAt(currentWsIdx)?.y ?? 0 : 0 - property real trailing: workspaces.count > 0 ? workspaces.itemAt(currentWsIdx)?.y ?? 0 : 0 - property real currentSize: workspaces.count > 0 ? workspaces.itemAt(currentWsIdx)?.size ?? 0 : 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; + let wss = monitorWorkspaces; + for (let i = 0; i < wss.length; i++) { + let ws = wss[i]; + if (ws.id == activeWsId) + return i; } - return s; } + property real currentSize: workspaces.itemAt(currentWsIdx)?.size ?? 0 + 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 {} } |