make ws clickable

This commit is contained in:
lucy 2026-05-18 09:05:14 +02:00
commit ffd60a616a
2 changed files with 21 additions and 9 deletions

View file

@ -15,27 +15,39 @@ Rectangle {
property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen)
radius: Config.rounding radius: Config.rounding
color: Colors.base01 color: Colors.base01
implicitWidth: wsLayout.implicitWidth + 32 implicitWidth: wsLayout.implicitWidth
implicitHeight: moduleHeight implicitHeight: moduleHeight
RowLayout { RowLayout {
id: wsLayout id: wsLayout
anchors.centerIn: parent anchors.centerIn: root
anchors.fill: root
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
spacing: 8 spacing: 0
Repeater { Repeater {
id: wsRepeater id: wsRepeater
model: Hyprland.workspaces model: Hyprland.workspaces
delegate: WrapperRectangle { delegate: Rectangle {
id: wsWrapper id: wsWrapper
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
implicitHeight: root.moduleHeight - 4
implicitWidth: modelData.active ? 48 : 32
parent: wsLayout parent: wsLayout
color: 'transparent' color: modelData.active ? Colors.base0D : Colors.base01
radius: Config.rounding
visible: modelData.monitor == root.hyprBarScreen visible: modelData.monitor == root.hyprBarScreen
required property var modelData required property var modelData
child: StyledText { StyledText {
anchors.centerIn: parent
text: wsWrapper.modelData.id text: wsWrapper.modelData.id
opacity: wsWrapper.modelData.active ? 1.0 : 0.6 color: parent.modelData.active ? Colors.base00 : Colors.base07
}
MouseArea {
id: clickHandler
anchors.fill: parent
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: parent.modelData.activate()
} }
} }
} }

View file

@ -1,7 +1,7 @@
[General] [General]
barHeight=34 barHeight=34
font=FiraCode Nerd Font font=Google Sans
fontSize=14 fontSize=14
opacity=1 opacity=1
roudning=16 roudning=16
wallpaper=@Variant(\0\0\0\x11\0\0\0'file:///home/lucy/.wall/frierensuff.png) wallpaper=@Variant(\0\0\0\x11\0\0\0)file:///home/lucy/.wall/walkingcastle.png)