Files
quickdots/bar/modules/Workspace.qml

58 lines
1.7 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.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() }
}
}
}
}