import Quickshell import Quickshell.Services.SystemTray import Quickshell.Widgets import QtQuick import "../components" Item { id: root required property var barWindow implicitWidth: trayRow.width implicitHeight: 24 Row { id: trayRow anchors.verticalCenter: parent.verticalCenter spacing: 3 Repeater { model: SystemTray.items delegate: Item { id: trayDelegate required property var modelData width: 24 height: 24 // Hover highlight Rectangle { anchors.fill: parent radius: Theme.radius color: hoverArea.containsMouse ? Qt.rgba(1,1,1,0.08) : "transparent" Behavior on color { ColorAnimation { duration: 80 } } } TrayIcon { anchors.centerIn: parent icon: trayDelegate.modelData.icon size: 16 } MouseArea { id: hoverArea anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: mouse => { const item = trayDelegate.modelData const wantsMenu = mouse.button === Qt.RightButton || item.onlyMenu if (wantsMenu && item.hasMenu) { // display() needs the quickshell PanelWindow (not QQuickWindow). // mapToItem(null) gives scene/window-local coordinates. const pos = trayDelegate.mapToItem(null, 0, trayDelegate.height) item.display(root.barWindow, Math.round(pos.x), Math.round(pos.y)) } else if (!item.onlyMenu) { item.activate() } } } } } } }