From 7f59246c6dd1952b05ed074dbe681e146249a917 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 5 Jan 2026 20:27:39 +0100 Subject: [PATCH] make bar work with bottom position --- .../hefty/topLayer/HAbstractMorphedPanel.qml | 8 +- .../ii/modules/hefty/topLayer/HBar.qml | 79 +++++++++++++++---- .../ii/modules/hefty/topLayer/HOverview.qml | 37 ++++++--- .../modules/hefty/topLayer/HTopLayerPanel.qml | 27 ++----- 4 files changed, 100 insertions(+), 51 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml index 53b03769a..2dd545f96 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HAbstractMorphedPanel.qml @@ -15,8 +15,12 @@ Item { id: root // To be fed - required property int screenWidth - required property int screenHeight + property int screenWidth: QsWindow.window.width + property int screenHeight: QsWindow.window.height + + // Signals + signal requestFocus() + signal dismissed() // Some info property int reservedTop: 0 diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml index cdfa7a05c..d3ba215da 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HBar.qml @@ -36,45 +36,71 @@ HAbstractMorphedPanel { function getHug(cornerStyle) { return cornerStyle === 0; } + property int reservedArea: barHeight + getEdgeGap(Config.options.bar.cornerStyle) // Some info - reservedTop: barHeight + getEdgeGap(Config.options.bar.cornerStyle) + reservedTop: Config.options.bar.bottom ? 0 : reservedArea + reservedBottom: Config.options.bar.bottom ? reservedArea : 0 // Background backgroundPolygon: { // It's certainly cleaner to have the below props declared outside, but we do this - // to make sure config change only makes this re-evaluate exactly once + // to make sure a config change only makes this re-evaluate exactly once + const bottom = Config.options.bar.bottom const cornerStyle = Config.options.bar.cornerStyle const rounding = root.getRounding(cornerStyle) const edgeGap = root.getEdgeGap(cornerStyle) const edgeRounding = root.getEdgeRounding(cornerStyle) const hug = root.getHug(cornerStyle) - const points = [ + const xLeft = edgeGap + const xRight = root.screenWidth - edgeGap + const yTop = bottom ? (root.screenHeight - edgeGap - barHeight) : edgeGap + const yBottom = bottom ? (root.screenHeight - edgeGap) : (edgeGap + barHeight) + const topRounding = bottom ? rounding : edgeRounding + const bottomRounding = bottom ? edgeRounding : rounding + var topCornerDirection, bottomCornerDirection; + if (cornerStyle === 2) { // Rect + topCornerDirection = 0; + bottomCornerDirection = 0; + } else if (cornerStyle === 1) { // Rect + topCornerDirection = 1; + bottomCornerDirection = -1; + } else { // Hug + topCornerDirection = bottom ? -1 : 1; + bottomCornerDirection = bottom ? -1 : 1; + } + const points = [ // bottom-middle - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth / 2, root.barHeight + edgeGap), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth * 1/2, yBottom), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth * 0.1, yBottom), new CornerRounding.CornerRounding(0)), // bottom-left /|| - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap + rounding, edgeGap + barHeight), new CornerRounding.CornerRounding(0)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap + barHeight), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap + barHeight + rounding * (hug ? 1 : -1)), new CornerRounding.CornerRounding(edgeRounding)), + new MaterialShapes.PointNRound(new Offset.Offset(xLeft + rounding, yBottom), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(xLeft, yBottom), new CornerRounding.CornerRounding(bottomRounding)), + new MaterialShapes.PointNRound(new Offset.Offset(xLeft, yBottom + rounding * bottomCornerDirection), new CornerRounding.CornerRounding(edgeRounding)), // top-left |/- - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap + rounding), new CornerRounding.CornerRounding(0)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap), new CornerRounding.CornerRounding(edgeRounding)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap + rounding, edgeGap), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(xLeft, yTop + rounding * topCornerDirection), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(xLeft, yTop), new CornerRounding.CornerRounding(topRounding)), + new MaterialShapes.PointNRound(new Offset.Offset(xLeft + rounding, yTop), new CornerRounding.CornerRounding(0)), // top-middle - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth / 2, edgeGap), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth * 0.1, yTop), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth * 1/2, yTop), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth * 0.9, yTop), new CornerRounding.CornerRounding(0)), // top-right -\| - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap - rounding, edgeGap), new CornerRounding.CornerRounding(0)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, edgeGap), new CornerRounding.CornerRounding(edgeRounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, edgeGap + rounding), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(xRight - rounding, yTop), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(xRight, yTop), new CornerRounding.CornerRounding(topRounding)), + new MaterialShapes.PointNRound(new Offset.Offset(xRight, yTop + rounding * topCornerDirection), new CornerRounding.CornerRounding(0)), // bottom-right ||\ - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, root.barHeight + edgeGap + rounding * (hug ? 1 : -1)), new CornerRounding.CornerRounding(edgeRounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, root.barHeight + edgeGap), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap - rounding, root.barHeight + edgeGap), new CornerRounding.CornerRounding(0)), + new MaterialShapes.PointNRound(new Offset.Offset(xRight, yBottom + rounding * bottomCornerDirection), new CornerRounding.CornerRounding(edgeRounding)), + new MaterialShapes.PointNRound(new Offset.Offset(xRight, yBottom), new CornerRounding.CornerRounding(bottomRounding)), + new MaterialShapes.PointNRound(new Offset.Offset(xRight - rounding, yBottom), new CornerRounding.CornerRounding(0)), + + // bottom-middle + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth * 0.9, yBottom), new CornerRounding.CornerRounding(0)), ] return MaterialShapes.customPolygon(points, 1, new Offset.Offset(root.screenWidth / 2, edgeGap + barHeight / 2)) } @@ -83,7 +109,26 @@ HAbstractMorphedPanel { implicitHeight: barHeight + getEdgeGap(Config.options.bar.cornerStyle) * 2 anchors { top: parent.top + bottom: undefined left: parent.left right: parent.right } + states: State { + name: "bottom" + when: Config.options.bar.bottom + AnchorChanges { + target: root + anchors.top: undefined + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } + } + transitions: Transition { + AnchorAnimation { + duration: 500 + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.animationCurves.expressiveDefaultSpatial + } + } } diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HOverview.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HOverview.qml index 960693fb1..30c71b995 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HOverview.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HOverview.qml @@ -13,30 +13,32 @@ HAbstractMorphedPanel { property int edgeGap: Appearance.sizes.hyprlandGapsOut property real rounding: Appearance.rounding.windowRounding property real contentHeight: 300 // For now + property real contentWidth: root.screenWidth * 0.9 + property real horizontalGap: (root.screenWidth - contentWidth) / 2 // Background backgroundPolygon: MaterialShapes.customPolygon([ // bottom-middle new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth / 2, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(0)), // bottom-left - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap + rounding, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap + root.contentHeight - rounding), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(horizontalGap + rounding, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(horizontalGap, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(horizontalGap, edgeGap + root.contentHeight - rounding), new CornerRounding.CornerRounding(rounding)), // top-left - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap + rounding), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap, edgeGap), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(edgeGap + rounding, edgeGap), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(horizontalGap, edgeGap + rounding), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(horizontalGap, edgeGap), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(horizontalGap + rounding, edgeGap), new CornerRounding.CornerRounding(rounding)), // top-middle new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth / 2, edgeGap), new CornerRounding.CornerRounding(0)), // top-right - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap - rounding, edgeGap), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, edgeGap), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, edgeGap + rounding), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - horizontalGap - rounding, edgeGap), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - horizontalGap, edgeGap), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - horizontalGap, edgeGap + rounding), new CornerRounding.CornerRounding(rounding)), // bottom-right - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, edgeGap + root.contentHeight - rounding), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), - new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - edgeGap - rounding, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - horizontalGap, edgeGap + root.contentHeight - rounding), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - horizontalGap, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), + new MaterialShapes.PointNRound(new Offset.Offset(root.screenWidth - horizontalGap - rounding, edgeGap + root.contentHeight), new CornerRounding.CornerRounding(rounding)), ], 1, new Offset.Offset(root.screenWidth / 2, edgeGap + contentHeight / 2)) // Keybinds @@ -72,4 +74,15 @@ HAbstractMorphedPanel { GlobalStates.superReleaseMightTrigger = false; } } + + Connections { + target: GlobalStates + function onOverviewOpenChanged() { + if (GlobalStates.overviewOpen) { + root.requestFocus(); + } else { + root.dismissed(); + } + } + } } \ No newline at end of file diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml index 9109d4769..526ed653a 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml @@ -45,15 +45,11 @@ PanelWindow { easing.type: Easing.BezierSpline easing.bezierCurve: Appearance.animationCurves.expressiveDefaultSpatial } - // animation: SpringAnimation { - // spring: 3.5 - // damping: 0.3 - // } color: Appearance.colors.colLayer0 borderWidth: (root.currentPanel === bar && Config.options.bar.cornerStyle !== 1) ? 0 : 1 borderColor: Appearance.colors.colLayer0Border visible: false // cuz there's already the shadow - // debug: true + debug: true } DropShadow { id: shadow @@ -87,27 +83,18 @@ PanelWindow { ////////////// Content: Panels /////////////// + function dismiss() { + root.currentPanel = bar; + } + HBar { id: bar - screenWidth: root.width - screenHeight: root.height } HOverview { id: overview - screenWidth: root.width - screenHeight: root.height - } - - Connections { - target: GlobalStates - function onOverviewOpenChanged() { - if (GlobalStates.overviewOpen) { - currentPanel = overview; - } else { - currentPanel = bar; - } - } + onRequestFocus: root.currentPanel = overview; + onDismissed: root.dismiss(); } //////////////// Components /////////////////