bar: fix active workspace indicator anims
Fix delayed anim when size change Fix trail with variable sized workspaces
This commit is contained in:
parent
e3dcdbb67c
commit
7c3f82f951
2 changed files with 26 additions and 6 deletions
|
|
@ -21,7 +21,7 @@ Singleton {
|
||||||
property bool activeIndicator: true
|
property bool activeIndicator: true
|
||||||
property bool occupiedBg: false
|
property bool occupiedBg: false
|
||||||
property bool showWindows: true
|
property bool showWindows: true
|
||||||
property bool activeTrail: !showWindows // Doesn't work well with variable sized workspaces
|
property bool activeTrail: false
|
||||||
property string label: " "
|
property string label: " "
|
||||||
property string occupiedLabel: " "
|
property string occupiedLabel: " "
|
||||||
property string activeLabel: " "
|
property string activeLabel: " "
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,32 @@ StyledRect {
|
||||||
required property real maskHeight
|
required property real maskHeight
|
||||||
required property int groupOffset
|
required property int groupOffset
|
||||||
|
|
||||||
readonly property Workspace currentWs: workspaces[Hyprland.activeWsId - 1 - groupOffset] ?? null
|
readonly property int currentWsIdx: Hyprland.activeWsId - 1 - groupOffset
|
||||||
property real leading: currentWs?.y ?? 0
|
property real leading: getWsY(currentWsIdx)
|
||||||
property real trailing: currentWs?.y ?? 0
|
property real trailing: getWsY(currentWsIdx)
|
||||||
property real currentSize: (currentWs?.size) ?? 0
|
property real currentSize: workspaces[currentWsIdx]?.size ?? 0
|
||||||
property real size: Math.abs(leading - trailing) + currentSize
|
|
||||||
property real offset: Math.min(leading, trailing)
|
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
|
clip: true
|
||||||
x: 1
|
x: 1
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue