68 lines
2.1 KiB
QML
68 lines
2.1 KiB
QML
import QtQuick // for Text
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Widgets
|
|
|
|
Item {
|
|
implicitHeight: 10 + rep.count * (2 * lay.spacing + 25)
|
|
implicitWidth: 30
|
|
|
|
Component.onCompleted: Hyprland.refreshWorkspaces()
|
|
|
|
ClippingWrapperRectangle {
|
|
color: Pywal.colors.color1
|
|
radius: 3
|
|
anchors.fill: parent
|
|
ColumnLayout {
|
|
id: lay
|
|
Repeater {
|
|
id: rep
|
|
|
|
property var ws: {
|
|
let arr = [];
|
|
Hyprland.workspaces.values.forEach((w) => { if(w.id > 0) arr.push(w) })
|
|
return arr;
|
|
}
|
|
|
|
model: ws
|
|
WrapperMouseArea {
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
|
ClippingWrapperRectangle {
|
|
id: rect
|
|
radius: 3
|
|
implicitWidth: 24
|
|
implicitHeight: 24
|
|
color: {
|
|
Hyprland.focusedWorkspace.id == rep.model[index].id
|
|
? Pywal.colors.color13
|
|
: containsMouse
|
|
? Pywal.colors.color12
|
|
: Pywal.colors.color4
|
|
}
|
|
|
|
Text {
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
text: rep.model[index].id
|
|
|
|
color: {
|
|
Hyprland.focusedWorkspace.id == rep.model[index].id
|
|
? Pywal.colors.color1
|
|
: Pywal.special.foreground
|
|
}
|
|
}
|
|
}
|
|
hoverEnabled: true
|
|
onClicked: {
|
|
rep.model[index].activate()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|