pragma ComponentBehavior: Bound import Quickshell import Quickshell.Hyprland import Quickshell.Widgets import QtQuick import QtQuick.Layouts import qs import qs.widgets import qs.settings 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 implicitHeight: moduleHeight RowLayout { id: wsLayout anchors.centerIn: root anchors.horizontalCenter: parent.horizontalCenter spacing: 0 Repeater { id: wsRepeater model: 10 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 implicitHeight: root.moduleHeight implicitWidth: 16 parent: wsLayout color: 'transparent' radius: Config.rounding StyledText { anchors.centerIn: parent text: wsWrapper.modelData + 1 color: wsWrapper.active ? Colors.base0D : Colors.base05 opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0 } MouseArea { id: clickHandler anchors.fill: parent acceptedButtons: Qt.LeftButton cursorShape: Qt.PointingHandCursor onClicked: Hyprland.dispatch("workspace " + wsWrapper.wsId) } } } } }