69 lines
1.7 KiB
QML
69 lines
1.7 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import ".."
|
|
|
|
// A row of clickable workspace buttons for one screen.
|
|
// The button for the workspace currently active on *this* screen is highlighted.
|
|
|
|
RowLayout {
|
|
id: root
|
|
|
|
required property var screen
|
|
|
|
spacing: 4
|
|
|
|
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(screen)
|
|
|
|
Repeater {
|
|
model: Hyprland.workspaces
|
|
|
|
delegate: Rectangle {
|
|
id: btn
|
|
|
|
required property HyprlandWorkspace modelData
|
|
|
|
readonly property bool isActive: root.monitor ? (root.monitor.activeWorkspace?.id === modelData.id) : modelData.focused
|
|
readonly property bool isUrgent: modelData.urgent
|
|
|
|
implicitWidth: Math.max(28, label.implicitWidth + 16)
|
|
implicitHeight: 22
|
|
radius: 4
|
|
|
|
color: isActive ? Colors.accent : isUrgent ? Colors.warning : Colors.surface
|
|
|
|
Behavior on color {
|
|
ColorAnimation {
|
|
duration: 80
|
|
}
|
|
}
|
|
|
|
Text {
|
|
id: label
|
|
anchors.centerIn: parent
|
|
text: btn.modelData.name
|
|
color: (btn.isActive || btn.isUrgent) ? Colors.bg : Colors.fg
|
|
font.pixelSize: 13
|
|
font.weight: btn.isActive ? Font.Bold : Font.Normal
|
|
|
|
Behavior on color {
|
|
ColorAnimation {
|
|
duration: 80
|
|
}
|
|
}
|
|
}
|
|
|
|
HoverHandler {
|
|
id: hoverArea
|
|
}
|
|
|
|
TapHandler {
|
|
onTapped: btn.modelData.activate()
|
|
}
|
|
}
|
|
}
|
|
}
|