59 lines
1.8 KiB
QML
59 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
|
|
radius: Config.rounding
|
|
color: 'transparent'
|
|
implicitWidth: wsLayout.implicitWidth + 10
|
|
implicitHeight: moduleHeight
|
|
|
|
RowLayout {
|
|
id: wsLayout
|
|
anchors.centerIn: root
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
spacing: 10
|
|
Repeater {
|
|
id: wsRepeater
|
|
model: Hyprland.workspaces
|
|
delegate: Rectangle {
|
|
id: wsWrapper
|
|
required property var modelData
|
|
property bool active: modelData.active
|
|
property bool vacant: modelData.toplevels.values.length === 0
|
|
visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor
|
|
|
|
implicitHeight: root.moduleHeight
|
|
implicitWidth: wsName.width
|
|
parent: wsLayout
|
|
color: 'transparent'
|
|
radius: Config.rounding
|
|
|
|
StyledText {
|
|
id: wsName
|
|
anchors.centerIn: parent
|
|
text: wsWrapper.modelData.name
|
|
color: wsWrapper.active ? Colors.base0D : Colors.base04
|
|
opacity: wsWrapper.active ? 1.0 : 0.4
|
|
font.bold: wsWrapper.active
|
|
}
|
|
MouseArea {
|
|
id: clickHandler
|
|
anchors.fill: parent
|
|
acceptedButtons: Qt.LeftButton
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: wsWrapper.modelData.activate()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|