quickshell/2

62 lines
2.7 KiB
Text

pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Hyprland
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
import qs
import qs.widgets
import qs.settings
Rectangle {
id: root
required property ShellScreen barScreen
required property double moduleHeight
property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen)
radius: Config.rounding
color: 'transparent'
implicitWidth: wsLayout.implicitWidth
implicitHeight: moduleHeight
RowLayout {
id: wsLayout
anchors.centerIn: root
anchors.horizontalCenter: parent.horizontalCenter
spacing: 0
Repeater {
id: wsRepeater
model: 11
delegate: Rectangle {
id: wsWrapper
implicitHeight: root.moduleHeight
implicitWidth: 16
parent: wsLayout
color: 'transparent'
radius: Config.rounding
visible: Hyprland.workspaces?.values[modelData].monitor == root.hyprBarScreen
required property var modelData
StyledText {
anchors.centerIn: parent
text: wsWrapper.modelData
color: Hyprland.workspaces?.values[modelData].active ? Colors.base0D : Colors.base04
opacity: parent.modelData.active ? 1.0 : 0.5
}
Behavior on implicitWidth {
NumberAnimation {
easing.type: Easing.InOutBack
easing.amplitude: 2
duration: 400
easing.overshoot: 2
}
}
MouseArea {
id: clickHandler
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: parent.modelData.activate()
}
}
}
}
}