77 lines
2.7 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Widgets
import Quickshell.Hyprland
import QtQuick
import Qt5Compat.GraphicalEffects
import QtQuick.Layouts
import qs
import qs.settings
import qs.widgets
WrapperRectangle {
id: wsWrap
margin: Settings.config.barmargins
leftMargin: margin * 2
required property ShellScreen barScreen
color: "transparent"
radius: Settings.config.rounding
implicitWidth: wsLayout.implicitWidth + 6
implicitHeight: Settings.config.barHeight - margin * 2
child: Item {
RowLayout {
id: wsLayout
spacing: 6
anchors.centerIn: parent
Repeater {
id: wsRep
model: Hyprland.workspaces
delegate: Rectangle {
id: wsRect
layer {
enabled: true
effect: DropShadow {
color: "#111111"
radius: 0
verticalOffset: 2
horizontalOffset: 2
samples: 16
}
}
implicitWidth: modelData.focused ? Settings.config.barHeight * 1.5 : Settings.config.barHeight / 2 + 10
implicitHeight: Settings.config.barHeight - wsWrap.margin * 2
visible: modelData.id < 0 ? false : modelData.monitor?.name == wsWrap.barScreen.name
required property var modelData
color: modelData.focused ? Colors.base0D : Colors.base02
radius: Settings.config.rounding
CText {
id: wsText
anchors.centerIn: parent
text: wsRect.modelData.id
opacity: 1
color: parent.modelData.focused ? Colors.base00 : Colors.base05
}
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();
}
}
}
}
}
}
}