pragma Singleton import QtQuick import QtQuick.Layouts // Workspaces.qml import Quickshell import Quickshell.Widgets import qs.Common import qs.Common.Styled import qs.Services Singleton { id: root property bool showWindow: false function start(component, type) { HoverMediator.component = component; HoverMediator.type = type; hoverTimer.start(); } function exit() { hoverTimer.stop(); root.showWindow = false; } Timer { id: hoverTimer interval: 300 onTriggered: { // wsPopUp.opacity = 1 root.showWindow = true; } } LazyLoader { active: root.showWindow component: PopupWindow { id: hoverPopUp anchor.item: HoverMediator.component property bool initialized: false anchor.rect.y: HoverMediator.y anchor.rect.x: (HoverMediator.x - this.implicitWidth) / 2 implicitHeight: wsPopUp.implicitHeight implicitWidth: wsPopUp.implicitWidth visible: true color: "transparent" Component { id: stub StyledText { text: "stub" } } Component { id: systray StyledText { text: { if (!HoverMediator.component?.model) return ""; if (HoverMediator.component.model.tooltipTitle) return HoverMediator.component.model.tooltipTitle; if (HoverMediator.component.model.title) return HoverMediator.component.model.title; else return ""; } } } Component { id: time RowLayout{ id: rowlayoutCalendar readonly property date now: new Date() readonly property int prevMonth: now.getMonth() - 1 readonly property int currentMonth: now.getMonth() readonly property int nextMonth: now.getMonth() + 1 implicitWidth: childrenRect.width implicitHeight: childrenRect.height spacing: 20 CalendarComponent { Layout.fillHeight: true Layout.fillWidth: true targetYear: parent.prevMonth < 0 ? parent.now.getFullYear() - 1 : parent.now.getFullYear() targetMonth: parent.prevMonth < 0 ? 11 : parent.prevMonth currentDate: parent.now } CalendarComponent { Layout.fillHeight: true Layout.fillWidth: true targetYear: parent.now.getFullYear() targetMonth: parent.currentMonth currentDate: parent.now } CalendarComponent { Layout.fillHeight: true Layout.fillWidth: true targetYear: parent.nextMonth > 11 ? parent.now.getFullYear() + 1 : parent.now.getFullYear() targetMonth: parent.nextMonth > 11 ? 0 : parent.nextMonth currentDate: parent.now } } } Component { id: audio StyledText { property string sinkDescription: (HoverMediator.component.sink) ? HoverMediator.component.sink.description : "" text: sinkDescription } } Component { id: workspaceComponent RowLayout { id: wsPopUpRow property int workspaceIndexAlign: HoverMediator.component.workspaceIndexAlign || 0 Repeater { property var modelo: HyprlandService.sortedDesktopApplications.get(parent.workspaceIndexAlign) model: modelo delegate: IconImage { required property var modelData width: 30 height: 30 source: (modelData && modelData.icon) ? Quickshell.iconPath(modelData.icon, 1) : "" } } } } BackgroundRectangle { id: wsPopUp MarginWrapperManager { leftMargin: (Theme.gaps * 2) rightMargin: (Theme.gaps * 2) topMargin: Theme.gaps bottomMargin: Theme.gaps } color: Theme.backgroudColor radius: 25 opacity: 1 Behavior on opacity { NumberAnimation { property: "opacity" duration: Theme.animationDuration } } Loader { id: hoverLoader sourceComponent: { if (!HoverMediator.type) return stub; if (HoverMediator.type === "workspace") return workspaceComponent; if (HoverMediator.type === "audio") return audio; if (HoverMediator.type === "time") return time; if (HoverMediator.type === "systray") return systray; } } } } } }