quickshell/modules/bar/Ws.qml
2026-05-31 18:18:12 +02:00

61 lines
1.9 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: 'transparent'
implicitWidth: wsLayout.implicitWidth
implicitHeight: moduleHeight
RowLayout {
id: wsLayout
anchors.centerIn: root
anchors.horizontalCenter: parent.horizontalCenter
spacing: 0
Repeater {
id: wsRepeater
model: Hyprland.workspaces
delegate: Rectangle {
id: wsWrapper
implicitHeight: root.moduleHeight
implicitWidth: 16
parent: wsLayout
color: 'transparent'
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.base07 : Colors.base04
}
Behavior on implicitWidth {
NumberAnimation {
easing.type: Easing.InOutBack
easing.amplitude: 2
duration: 400
easing.overshoot: 2
}
}
MouseArea {
id: clickHandler
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: parent.modelData.activate()
}
}
}
}
}