64 lines
1.9 KiB
QML
64 lines
1.9 KiB
QML
// modules/SysTrayWidget.qml - SNI system tray (nm-applet, blueman ...)
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell.Services.SystemTray
|
|
import ".."
|
|
|
|
Rectangle {
|
|
id: root
|
|
color: "transparent"
|
|
radius: Theme.radius
|
|
|
|
implicitWidth: trayRow.implicitWidth + 6
|
|
implicitHeight: Theme.barHeight
|
|
|
|
RowLayout {
|
|
id: trayRow
|
|
anchors.centerIn: parent
|
|
spacing: Theme.spacing
|
|
|
|
Repeater {
|
|
model: SystemTray.items
|
|
|
|
Rectangle {
|
|
required property SystemTrayItem modelData
|
|
width: 22; height: 22
|
|
radius: Theme.radius
|
|
color: trayHover.containsMouse
|
|
? Theme.pillHover
|
|
: Qt.rgba(0.976, 0.945, 0.851, 0.15)
|
|
|
|
Behavior on color { ColorAnimation { duration: 150 } }
|
|
|
|
Image {
|
|
anchors { fill: parent; margins: 4 }
|
|
source: modelData.icon
|
|
fillMode: Image.PreserveAspectFit
|
|
smooth: true
|
|
}
|
|
|
|
MouseArea {
|
|
id: trayHover
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
onClicked: (m) => {
|
|
if (m.button === Qt.LeftButton)
|
|
modelData.activate()
|
|
else
|
|
modelData.contextMenu(mapToGlobal(mouseX, mouseY))
|
|
}
|
|
}
|
|
|
|
// Attention indicator dot
|
|
Rectangle {
|
|
visible: modelData.status === SystemTrayItem.NeedsAttention
|
|
width: 5; height: 5; radius: 2.5
|
|
color: Theme.wsUrgent
|
|
anchors { bottom: parent.bottom; right: parent.right; margins: 1 }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|