fix ws.qml

This commit is contained in:
lucy 2026-06-02 23:57:12 +02:00
commit 597970e61b
3 changed files with 38 additions and 25 deletions

View file

@ -12,13 +12,6 @@ Rectangle {
id: root
required property ShellScreen barScreen
required property double moduleHeight
property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen)
// split-monitor-workspaces numbering: each monitor owns `count` (10)
// workspaces. eDP-1 -> ids 1..10, DP-2 -> ids 11..20. The offset is the
// first id on this monitor, minus 1.
property int wsIdOffset: root.barScreen.name != Config.primaryMon ? 10 : 0
radius: Config.rounding
color: 'transparent'
implicitWidth: wsLayout.implicitWidth
@ -31,24 +24,13 @@ Rectangle {
spacing: 0
Repeater {
id: wsRepeater
model: 10
model: Hyprland.workspaces
delegate: Rectangle {
id: wsWrapper
required property var modelData
property int wsId: root.wsIdOffset + modelData + 1
property var ws: {
const vals = Hyprland.workspaces.values;
for (let i = 0; i < vals.length; ++i) {
if (vals[i].id === wsWrapper.wsId)
return vals[i];
}
return null;
}
property bool active: wsWrapper.ws ? wsWrapper.ws.active : false
property bool vacant: !wsWrapper.ws || wsWrapper.ws.toplevels.values.length === 0
property bool active: modelData.active
property bool vacant: modelData.toplevels.values.length === 0
visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor
implicitHeight: root.moduleHeight
implicitWidth: 16
@ -58,9 +40,10 @@ Rectangle {
StyledText {
anchors.centerIn: parent
text: wsWrapper.modelData + 1
color: wsWrapper.active ? Colors.base0D : Colors.base05
text: wsWrapper.modelData.id > 10 ? wsWrapper.modelData.id > 20 ? wsWrapper.modelData.id - 20 : wsWrapper.modelData.id - 10 : wsWrapper.modelData.id
color: wsWrapper.active ? Colors.base0D : Colors.base04
opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0
font.bold: wsWrapper.active
}
MouseArea {
id: clickHandler