59 lines
1.6 KiB
QML
59 lines
1.6 KiB
QML
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Widgets
|
|
import QtQuick
|
|
import "../components"
|
|
|
|
Rectangle {
|
|
id: root
|
|
required property var workspace
|
|
required property string screenName
|
|
|
|
visible: workspace?.lastIpcObject?.monitor === screenName
|
|
|
|
implicitWidth: Math.max(32, iconsRow.implicitWidth + 14)
|
|
implicitHeight: 18
|
|
radius: 6
|
|
color: workspace?.active ? Theme.accent : 'transparent'
|
|
|
|
Row {
|
|
id: iconsRow
|
|
anchors.centerIn: parent
|
|
spacing: 3
|
|
|
|
Repeater {
|
|
model: root.workspace?.toplevels
|
|
|
|
delegate: Item {
|
|
id: iconItem
|
|
required property var modelData
|
|
property string appClass: modelData.lastIpcObject["class"] ?? ""
|
|
property var entry: appClass !== "" ? DesktopEntries.heuristicLookup(appClass) : null
|
|
|
|
width: 16
|
|
height: 16
|
|
|
|
IconImage {
|
|
anchors.fill: parent
|
|
source: iconItem.entry && iconItem.entry.icon !== ""
|
|
? "image://icon/" + iconItem.entry.icon
|
|
: ""
|
|
}
|
|
}
|
|
}
|
|
|
|
// Workspace number shown when no windows are open
|
|
Text {
|
|
visible: (root.workspace?.toplevels?.values?.length ?? 0) === 0
|
|
text: root.workspace?.id ?? ""
|
|
color: root.workspace?.active ? Theme.text : Theme.textDim
|
|
font.pixelSize: 11
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Hyprland.dispatch("workspace " + root.workspace.id)
|
|
}
|
|
}
|