From dbcde24003e590b8f49b6a88f44ee7b5197bb23d Mon Sep 17 00:00:00 2001 From: wbbwbwbwbwbb Date: Sun, 12 Apr 2026 18:37:19 -0700 Subject: [PATCH 1/2] Fix dock preview not showing up after first hover --- .../ii/modules/ii/dock/DockApps.qml | 70 +++++++++---------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml b/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml index 8b4a3baab..efeac7856 100644 --- a/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml +++ b/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml @@ -17,14 +17,20 @@ Item { property real windowControlsHeight: 30 property real buttonPadding: 5 - property Item lastHoveredButton + property Item lastHoveredButton: null property bool buttonHovered: false property bool requestDockShow: previewPopup.show Layout.fillHeight: true - Layout.topMargin: Appearance.sizes.hyprlandGapsOut // why does this work + Layout.topMargin: Appearance.sizes.hyprlandGapsOut implicitWidth: listView.implicitWidth - + + function popupCenterXForButton(button) { + if (!button || !root.QsWindow) + return 0 + return root.QsWindow.mapFromItem(button, button.width / 2, 0).x + } + StyledListView { id: listView spacing: 2 @@ -56,37 +62,32 @@ Item { PopupWindow { id: previewPopup property var appTopLevel: root.lastHoveredButton?.appToplevel - property bool allPreviewsReady: false + + property bool shouldShow: (popupMouseArea.containsMouse || root.buttonHovered) + && appTopLevel + && appTopLevel.toplevels + && appTopLevel.toplevels.length > 0 + + property bool show: false + property real cachedCenterX: 0 + Connections { target: root function onLastHoveredButtonChanged() { - previewPopup.allPreviewsReady = false; // Reset readiness when the hovered button changes - } - } - function updatePreviewReadiness() { - for(var i = 0; i < previewRowLayout.children.length; i++) { - const view = previewRowLayout.children[i]; - if (view.hasContent === false) { - allPreviewsReady = false; - return; - } + if (root.lastHoveredButton && root.QsWindow) + previewPopup.cachedCenterX = root.popupCenterXForButton(root.lastHoveredButton) + } + function onButtonHoveredChanged() { + if (root.buttonHovered && root.lastHoveredButton && root.QsWindow) + previewPopup.cachedCenterX = root.popupCenterXForButton(root.lastHoveredButton) + updateTimer.restart() } - allPreviewsReady = true; } - property bool shouldShow: { - const hoverConditions = (popupMouseArea.containsMouse || root.buttonHovered) - return hoverConditions && allPreviewsReady; - } - property bool show: false onShouldShowChanged: { - if (shouldShow) { - // show = true; - updateTimer.restart(); - } else { - updateTimer.restart(); - } + updateTimer.restart() } + Timer { id: updateTimer interval: 100 @@ -94,14 +95,15 @@ Item { previewPopup.show = previewPopup.shouldShow } } + anchor { window: root.QsWindow.window adjustment: PopupAdjustment.None gravity: Edges.Top | Edges.Right edges: Edges.Top | Edges.Left - } - visible: popupBackground.visible + + visible: popupBackground.opacity > 0 color: "transparent" implicitWidth: root.QsWindow.window?.width ?? 1 implicitHeight: popupMouseArea.implicitHeight + root.windowControlsHeight + Appearance.sizes.elevationMargin * 2 @@ -112,10 +114,8 @@ Item { implicitWidth: popupBackground.implicitWidth + Appearance.sizes.elevationMargin * 2 implicitHeight: root.maxWindowPreviewHeight + root.windowControlsHeight + Appearance.sizes.elevationMargin * 2 hoverEnabled: true - x: { - const itemCenter = root.QsWindow?.mapFromItem(root.lastHoveredButton, root.lastHoveredButton?.width / 2, 0); - return itemCenter.x - width / 2 - } + x: previewPopup.cachedCenterX - width / 2 + StyledRectangularShadow { target: popupBackground opacity: previewPopup.show ? 1 : 0 @@ -124,6 +124,7 @@ Item { animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) } } + Rectangle { id: popupBackground property real padding: 5 @@ -198,13 +199,10 @@ Item { } ScreencopyView { id: screencopyView - captureSource: previewPopup ? windowButton.modelData : null + captureSource: windowButton.modelData live: true paintCursor: true constraintSize: Qt.size(root.maxWindowPreviewWidth, root.maxWindowPreviewHeight) - onHasContentChanged: { - previewPopup.updatePreviewReadiness(); - } layer.enabled: true layer.effect: OpacityMask { maskSource: Rectangle { From 96bf8dcbf0db9f99715882cdb214db3ae9d96a77 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 13 Apr 2026 18:40:30 +0200 Subject: [PATCH 2/2] dock: fix window title alignment on popup --- .../ii/modules/ii/dock/DockApps.qml | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml b/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml index efeac7856..82ed76cf9 100644 --- a/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml +++ b/dots/.config/quickshell/ii/modules/ii/dock/DockApps.qml @@ -1,3 +1,4 @@ +pragma ComponentBehavior: Bound import Qt5Compat.GraphicalEffects import QtQuick import QtQuick.Controls @@ -27,8 +28,8 @@ Item { function popupCenterXForButton(button) { if (!button || !root.QsWindow) - return 0 - return root.QsWindow.mapFromItem(button, button.width / 2, 0).x + return 0; + return root.QsWindow.mapFromItem(button, button.width / 2, 0).x; } StyledListView { @@ -63,10 +64,7 @@ Item { id: previewPopup property var appTopLevel: root.lastHoveredButton?.appToplevel - property bool shouldShow: (popupMouseArea.containsMouse || root.buttonHovered) - && appTopLevel - && appTopLevel.toplevels - && appTopLevel.toplevels.length > 0 + property bool shouldShow: (popupMouseArea.containsMouse || root.buttonHovered) && appTopLevel && appTopLevel.toplevels && appTopLevel.toplevels.length > 0 property bool show: false property real cachedCenterX: 0 @@ -75,24 +73,24 @@ Item { target: root function onLastHoveredButtonChanged() { if (root.lastHoveredButton && root.QsWindow) - previewPopup.cachedCenterX = root.popupCenterXForButton(root.lastHoveredButton) + previewPopup.cachedCenterX = root.popupCenterXForButton(root.lastHoveredButton); } function onButtonHoveredChanged() { if (root.buttonHovered && root.lastHoveredButton && root.QsWindow) - previewPopup.cachedCenterX = root.popupCenterXForButton(root.lastHoveredButton) - updateTimer.restart() + previewPopup.cachedCenterX = root.popupCenterXForButton(root.lastHoveredButton); + updateTimer.restart(); } } onShouldShowChanged: { - updateTimer.restart() + updateTimer.restart(); } Timer { id: updateTimer interval: 100 onTriggered: { - previewPopup.show = previewPopup.shouldShow + previewPopup.show = previewPopup.shouldShow; } } @@ -157,6 +155,7 @@ Item { } RippleButton { id: windowButton + Layout.fillHeight: true required property var modelData padding: 0 middleClickAction: () => { @@ -182,8 +181,8 @@ Item { GroupButton { id: closeButton colBackground: ColorUtils.transparentize(Appearance.colors.colSurfaceContainer) - baseWidth: windowControlsHeight - baseHeight: windowControlsHeight + baseWidth: root.windowControlsHeight + baseHeight: root.windowControlsHeight buttonRadius: Appearance.rounding.full contentItem: MaterialSymbol { anchors.centerIn: parent @@ -197,18 +196,25 @@ Item { } } } - ScreencopyView { - id: screencopyView - captureSource: windowButton.modelData - live: true - paintCursor: true - constraintSize: Qt.size(root.maxWindowPreviewWidth, root.maxWindowPreviewHeight) - layer.enabled: true - layer.effect: OpacityMask { - maskSource: Rectangle { - width: screencopyView.width - height: screencopyView.height - radius: Appearance.rounding.small + Item { + Layout.fillWidth: true + Layout.fillHeight: true + implicitHeight: screencopyView.height + implicitWidth: screencopyView.width + ScreencopyView { + id: screencopyView + anchors.centerIn: parent + captureSource: windowButton.modelData + live: true + paintCursor: true + constraintSize: Qt.size(root.maxWindowPreviewWidth, root.maxWindowPreviewHeight) + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + width: screencopyView.width + height: screencopyView.height + radius: Appearance.rounding.small + } } } }