quickshell/modules/bar/Workspaces.qml

47 lines
1.4 KiB
QML
Raw Normal View History

pragma ComponentBehavior: Bound
2025-12-21 20:59:33 +01:00
import Quickshell.Hyprland
import QtQuick
import "../../"
2025-12-21 20:59:33 +01:00
Item {
id: root
2025-12-21 21:24:03 +01:00
implicitWidth: workspaceRow.implicitWidth
2025-12-21 20:59:33 +01:00
height: 30
Row {
2025-12-21 21:24:03 +01:00
id: workspaceRow
2025-12-21 20:59:33 +01:00
anchors.centerIn: parent
spacing: 10 // Slightly increase spacing between workspace buttons
Repeater {
id: wsRepeater
model: Hyprland.workspaces
anchors.centerIn: parent
2025-12-21 20:59:33 +01:00
Rectangle {
id: workspaceNumber
required property var modelData
2025-12-24 15:41:03 +01:00
width: 16
height: 16
radius: 20
2025-12-21 20:59:33 +01:00
color: modelData.active ? Colors.foreground : "transparent"
Text {
font.weight: 900
font.family: Appearance.font
font.pixelSize: Appearance.fontSize
anchors.centerIn: workspaceNumber
text: parent.modelData.id
color: parent.modelData.active ? Colors.background : Colors.foreground // Set contrasting color for workspace number
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: {
parent.modelData.activate();
}
2025-12-21 20:59:33 +01:00
}
}
}
}
}