61 lines
2 KiB
QML
61 lines
2 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 + 4
|
|
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 - 4
|
|
implicitWidth: modelData.active ? 48 : 24
|
|
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
|
|
}
|
|
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()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|