bar: workspaces scroll specialws

Same behaviour as astal workspaces scroll
Fix more undef errors
Also increase by more when transparent dark layer
This commit is contained in:
2 * r + 2 * t 2025-05-01 12:54:00 +10:00
parent b9fb55d007
commit a38de28e72
3 changed files with 9 additions and 8 deletions

View file

@ -23,7 +23,7 @@ Singleton {
return c;
c = Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base);
if (layer)
c.hsvValue = Math.max(0, Math.min(1, c.hslLightness + (light ? -0.2 : 0.1)));
c.hsvValue = Math.max(0, Math.min(1, c.hslLightness + (light ? -0.2 : 0.2)));
return c;
}

View file

@ -15,9 +15,9 @@ Rectangle {
required property int groupOffset
property int currentIdx: Hyprland.activeWsId - 1 - groupOffset
property real leading: workspaces[currentIdx][vertical ? "y" : "x"]
property real trailing: workspaces[currentIdx][vertical ? "y" : "x"]
property real currentSize: workspaces[currentIdx].size
property real leading: (vertical ? workspaces[currentIdx]?.y : workspaces[currentIdx]?.x) ?? 0
property real trailing: (vertical ? workspaces[currentIdx]?.y : workspaces[currentIdx]?.x) ?? 0
property real currentSize: (workspaces[currentIdx]?.size) ?? 0
property real size: Math.abs(leading - trailing) + currentSize
property real offset: Math.min(leading, trailing)

View file

@ -57,10 +57,11 @@ Item {
onPressed: event => Hyprland.dispatch(`workspace ${layout.childAt(event.x, event.y).index + root.groupOffset + 1}`)
onWheel: event => {
if (event.angleDelta.y < 0)
Hyprland.dispatch(`workspace r+1`);
else if (event.angleDelta.y > 0 && Hyprland.activeWorkspace.id > 1)
Hyprland.dispatch(`workspace r-1`);
const activeWs = Hyprland.activeClient?.workspace?.name;
if (activeWs?.startsWith("special:"))
Hyprland.dispatch(`togglespecialworkspace ${activeWs.slice(8)}`);
else if (event.angleDelta.y < 0 || Hyprland.activeWsId > 1)
Hyprland.dispatch(`workspace r${event.angleDelta.y > 0 ? "-" : "+"}1`);
}
}
}