Files
quickdots/bar/modules/Workspace.qml
2026-04-24 02:14:35 +00:00

63 lines
1.8 KiB
QML

import QtQuick
import QtQuick.Layouts
import Quickshell.Hyprland
import "../../config" as Cfg
Rectangle {
id: root
property real panelRadius: Cfg.Config.radius / 2
property int borderWidth: Cfg.Config.panelBorderWidth
readonly property var t: Cfg.Config.theme
width: workspaceLayout.implicitWidth + 24
height: Cfg.Config.moduleHeight
color: t.wsPanelBg
radius: panelRadius
border.color: t.wsPanelBorder
border.width: borderWidth
RowLayout {
id: workspaceLayout
anchors.centerIn: parent
spacing: 6
Repeater {
model: Hyprland.workspaces
Rectangle {
Layout.preferredWidth: modelData.active ? 34 : 28
Layout.preferredHeight: 22
radius: 11
color: modelData.active
? root.t.wsActiveBg
: (wsHover.containsMouse ? root.t.wsHoverBg : root.t.wsInactiveBg)
Behavior on color { ColorAnimation { duration: 200 } }
Behavior on Layout.preferredWidth { NumberAnimation { duration: 200 } }
Text {
anchors.centerIn: parent
text: modelData.name
font.pixelSize: 11
font.bold: true
color: modelData.active
? root.t.wsActiveText
: (wsHover.containsMouse ? root.t.wsHoverText : root.t.wsInactiveText)
}
MouseArea {
id: wsHover
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: modelData.activate()
}
}
}
}
}