diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-07 15:04:35 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-07 15:04:35 +1000 |
| commit | 7c3f82f9517fbb179bab1ebc9671ce421f6311d1 (patch) | |
| tree | 6c501a996e58260c331f0fad2244e2b3c6e3a278 /modules | |
| parent | internal: move bar to drawer window (diff) | |
| download | caelestia-shell-7c3f82f9517fbb179bab1ebc9671ce421f6311d1.tar.gz caelestia-shell-7c3f82f9517fbb179bab1ebc9671ce421f6311d1.tar.bz2 caelestia-shell-7c3f82f9517fbb179bab1ebc9671ce421f6311d1.zip | |
bar: fix active workspace indicator anims
Fix delayed anim when size change
Fix trail with variable sized workspaces
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/bar/components/workspaces/ActiveIndicator.qml | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/modules/bar/components/workspaces/ActiveIndicator.qml b/modules/bar/components/workspaces/ActiveIndicator.qml index d55bdb8..3f3ca62 100644 --- a/modules/bar/components/workspaces/ActiveIndicator.qml +++ b/modules/bar/components/workspaces/ActiveIndicator.qml @@ -13,12 +13,32 @@ StyledRect { required property real maskHeight required property int groupOffset - readonly property Workspace currentWs: workspaces[Hyprland.activeWsId - 1 - groupOffset] ?? null - property real leading: currentWs?.y ?? 0 - property real trailing: currentWs?.y ?? 0 - property real currentSize: (currentWs?.size) ?? 0 - property real size: Math.abs(leading - trailing) + currentSize + readonly property int currentWsIdx: Hyprland.activeWsId - 1 - groupOffset + property real leading: getWsY(currentWsIdx) + property real trailing: getWsY(currentWsIdx) + property real currentSize: workspaces[currentWsIdx]?.size ?? 0 property real offset: Math.min(leading, trailing) + property real size: { + const s = Math.abs(leading - trailing) + currentSize; + if (BarConfig.workspaces.activeTrail && lastWs > currentWsIdx) + return Math.min(getWsY(lastWs) + (workspaces[lastWs]?.size ?? 0) - offset, s); + return s; + } + + property int cWs + property int lastWs + + function getWsY(idx: int): real { + let y = 0; + for (let i = 0; i < idx; i++) + y += workspaces[i]?.size ?? 0; + return y; + } + + onCurrentWsIdxChanged: { + lastWs = cWs; + cWs = currentWsIdx; + } clip: true x: 1 |