46 lines
1.4 KiB
QML
46 lines
1.4 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell.Hyprland
|
|
import "../../config"
|
|
|
|
RowLayout {
|
|
id: root
|
|
property var screen
|
|
|
|
spacing: 4
|
|
|
|
Repeater {
|
|
model: Hyprland.workspaces
|
|
|
|
delegate: Rectangle {
|
|
id: pill
|
|
required property var modelData
|
|
visible: modelData.monitor && root.screen && modelData.monitor.name === root.screen.name
|
|
|
|
implicitWidth: 26
|
|
implicitHeight: 22
|
|
radius: Appearance.radiusSmall
|
|
color: modelData.urgent ? Colors.urgent
|
|
: modelData.active ? Colors.primary
|
|
: "transparent"
|
|
|
|
Behavior on color { ColorAnimation { duration: Appearance.animationDuration } }
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: modelData.name
|
|
font.family: Appearance.fontFamily
|
|
font.pixelSize: Appearance.fontSizeSmall
|
|
color: modelData.active ? Colors.primaryText : Colors.foreground
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
cursorShape: Qt.PointingHandCursor
|
|
// Hyprland's Lua config expects Lua syntax from dispatch
|
|
onClicked: Hyprland.dispatch("hl.dsp.focus({ workspace = " + JSON.stringify(modelData.id > 0 ? modelData.id : modelData.name) + " })")
|
|
}
|
|
}
|
|
}
|
|
}
|