Files
quickdots/bar/modules/Workspace.qml
2026-05-17 22:30:27 +00:00

52 lines
1.5 KiB
QML

import QtQuick
import QtQuick.Layouts
import Quickshell.Hyprland
import "../../config" as Cfg
import "../../components"
ModuleChip {
id: root
width: workspaceLayout.implicitWidth + 24
height: Cfg.Config.moduleHeight
chipColor: t.wsPanelBg
chipBorderColor: t.wsPanelBorder
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.hovered ? 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.hovered ? root.t.wsHoverText : root.t.wsInactiveText)
}
HoverHandler { id: wsHover; cursorShape: Qt.PointingHandCursor }
TapHandler { onTapped: modelData.activate() }
}
}
}
}