quickshell/modules/bar/Ws.qml
2026-05-18 09:05:14 +02:00

55 lines
1.8 KiB
QML

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)
radius: Config.rounding
color: Colors.base01
implicitWidth: wsLayout.implicitWidth
implicitHeight: moduleHeight
RowLayout {
id: wsLayout
anchors.centerIn: root
anchors.fill: root
anchors.horizontalCenter: parent.horizontalCenter
spacing: 0
Repeater {
id: wsRepeater
model: Hyprland.workspaces
delegate: Rectangle {
id: wsWrapper
anchors.verticalCenter: parent.verticalCenter
implicitHeight: root.moduleHeight - 4
implicitWidth: modelData.active ? 48 : 32
parent: wsLayout
color: modelData.active ? Colors.base0D : Colors.base01
radius: Config.rounding
visible: modelData.monitor == root.hyprBarScreen
required property var modelData
StyledText {
anchors.centerIn: parent
text: wsWrapper.modelData.id
color: parent.modelData.active ? Colors.base00 : Colors.base07
}
MouseArea {
id: clickHandler
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: parent.modelData.activate()
}
}
}
}
}