import QtQuick import Quickshell import "../../../config" PopupWindow { id: popup property Item anchorItem property bool anchorHovered: false property int minpopupWidth: 300 property int minpopupHeight: 50 property int popupVerticalOffset: 0 property int spacingValue: 12 property int radiusValue: 12 default property alias content: contentColumn.data visible: false color: "transparent" implicitWidth: Math.max(popup.minpopupWidth, contentColumn.implicitWidth + 2 * popup.spacingValue) implicitHeight: Math.max(popup.minpopupHeight, contentColumn.implicitHeight + 2 * popup.spacingValue) onAnchorHoveredChanged: popup.updateVisibility() function updateVisibility() { if (anchorHovered || mouseArea.containsMouse) { closeTimer.stop() visible = true } else { closeTimer.restart() } } Timer { id: closeTimer interval: 1 onTriggered: { if (!anchorHovered && !mouseArea.containsMouse) { visible = false } } } anchor { item: anchorItem edges: Edges.Top | Edges.Left gravity: Edges.Bottom | Edges.Right adjustment: PopupAdjustment.FlipY | PopupAdjustment.SlideX onAnchoring: { anchor.rect.x = (anchorItem.width - popup.width) / 2 anchor.rect.y = anchorItem.height + popupVerticalOffset } } MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true onContainsMouseChanged: popup.updateVisibility() Rectangle { id: background anchors.fill: parent color: Qt.alpha(Colors.primaryContainer, 0.9) radius: popup.radiusValue border { color: Colors.primaryContainer_fg width: Config.border_width } Column { id: contentColumn width: implicitWidth height: implicitHeight anchors { top: parent.top left: parent.left right: parent.right margins: popup.spacingValue } spacing: popup.spacingValue } } } }