repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by bugabinga
quickshell/nuguland/TrayPanel.qml
Rawpragma ComponentBehavior: Bound
import QtQuick
import "Util.js" as Util
Column {
id: root
required property Theme theme
required property Tray trayService
property var panelState: trayService ? Util.parseJson(trayService.stateJson(), {
"items": []
}) : ({
"items": []
})
readonly property var items: panelState.items || []
readonly property bool hasItems: items.length > 0
function refreshFrom(text) {
panelState = Util.parseJson(text, panelState);
}
function activate(id) {
if (trayService)
refreshFrom(trayService.activateRow(id));
}
spacing: 10
width: parent ? parent.width : 0
Flow {
objectName: "trayItems"
visible: root.hasItems
width: parent.width
spacing: 8
Repeater {
model: root.items
delegate: Rectangle {
id: itemCell
required property var modelData
readonly property bool attention: modelData.status === "NeedsAttention"
width: 168
height: 46
radius: 12
color: root.theme ? root.theme.withAlpha(attention ? root.theme.info : root.theme.ui.accent, attention ? 0.2 : 0.12) : "transparent"
border.width: 0
border.color: root.theme ? (attention ? root.theme.info : root.theme.ui.accent) : "transparent"
Row {
anchors.fill: parent
anchors.leftMargin: 11
anchors.rightMargin: 11
spacing: 10
Image {
anchors.verticalCenter: parent.verticalCenter
width: 24
height: 24
sourceSize.width: 24
sourceSize.height: 24
fillMode: Image.PreserveAspectFit
source: itemCell.modelData.icon || ""
visible: status === Image.Ready
}
NuguText {
anchors.verticalCenter: parent.verticalCenter
theme: root.theme
variant: "meta"
selected: itemCell.attention
text: itemCell.modelData.title
width: parent.width - 34
elide: Text.ElideRight
}
}
MouseArea {
anchors.fill: parent
onClicked: root.activate(itemCell.modelData.id)
}
}
}
}
Item {
objectName: "trayEmptyState"
visible: !root.hasItems
width: parent.width
height: 300
Column {
anchors.centerIn: parent
spacing: 12
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: 68
height: 68
radius: 34
color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.16) : "transparent"
NuguText {
anchors.centerIn: parent
theme: root.theme
variant: "title"
selected: true
text: "⌁"
}
}
NuguText {
anchors.horizontalCenter: parent.horizontalCenter
theme: root.theme
variant: "title"
text: "No tray icons"
}
NuguText {
anchors.horizontalCenter: parent.horizontalCenter
theme: root.theme
variant: "meta"
text: "Background apps show up here"
}
}
}
}