72 lines
2.3 KiB
QML
Raw Normal View History

pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Hyprland
import QtQuick
2026-03-19 11:32:23 +01:00
import Qt5Compat.GraphicalEffects
import QtQuick.Layouts
import qs
import qs.settings
import qs.widgets
Rectangle {
id: wsWrap
required property ShellScreen barScreen
color: "transparent"
radius: Settings.config.rounding
implicitWidth: wsLayout.implicitWidth + 6
implicitHeight: wsLayout.implicitHeight + 6
RowLayout {
id: wsLayout
spacing: 6
anchors.centerIn: parent
Repeater {
id: wsRep
model: Hyprland.workspaces
delegate: Rectangle {
2026-03-19 11:32:23 +01:00
layer {
enabled: true
effect: DropShadow {
color: Colors.base01
radius: 8
verticalOffset: 1
horizontalOffset: 1
samples: 18
}
}
id: wsRect
implicitWidth: modelData.focused ? Settings.config.barHeight * 1.5 : Settings.config.barHeight / 2 + 10
implicitHeight: Settings.config.barHeight / 1.5
visible: modelData.id < 0 ? false : modelData.monitor?.name == wsWrap.barScreen.name
required property var modelData
2026-03-19 11:32:23 +01:00
color: modelData.focused ? Colors.base0D : Colors.base02
radius: Settings.config.rounding
CText {
id: wsText
anchors.centerIn: parent
text: wsRect.modelData.id
2026-03-09 10:45:56 +01:00
opacity: parent.modelData.focused ? 1 : 0.5
2026-03-19 11:32:23 +01:00
color: parent.modelData.focused ? Colors.base00 : Colors.base07
}
Behavior on implicitWidth {
NumberAnimation {
easing {
type: Easing.OutBack
overshoot: 2
}
duration: 400
}
}
MouseArea {
id: mouseHandler
acceptedButtons: Qt.LeftButton
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
wsRect.modelData.activate();
}
}
}
}
}
}