quickshell/modules/bar/Ws.qml
2026-08-26 19:58:25 +02:00

50 lines
1.6 KiB
QML

import Quickshell
import Quickshell.WindowManager
import QtQuick
import QtQuick.Layouts
import qs
import qs.widgets
import qs.settings
BarComponent {
id: root
required property ShellScreen barScreen
implicitWidth: wsLayout.implicitWidth + 4
RowLayout {
id: wsLayout
anchors.centerIn: parent
spacing: 8
Repeater {
model: WindowManager.screenProjection(root.barScreen).windowsets
delegate: Rectangle {
id: wsContainer
required property var modelData
visible: modelData.shouldDisplay
implicitWidth: modelData.active ? 50 : 20
implicitHeight: Config.moduleHeight - 4
color: modelData.active ? Colors.base0D : Colors.activeModuleBg
radius: Config.rounding
Behavior on implicitWidth {
PropertyAnimation {
duration: 350
easing.type: Easing.InOutBack
easing.overshoot: 1.2
}
}
MouseArea {
id: clickHandler
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton
onClicked: wsContainer.modelData.activate()
}
StyledText {
id: wsText
anchors.centerIn: parent
text: parent.modelData.name
color: parent.modelData.active ? Colors.base00 : Colors.base0D
}
}
}
}
}