1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 02:52:07 -04:00

some more simplifications and bug fixes

This commit is contained in:
bbedward
2026-04-17 14:48:38 -04:00
committed by purian23
parent f5c841569a
commit 594d0f163d
9 changed files with 130 additions and 257 deletions

View File

@@ -43,43 +43,6 @@ Item {
property int __volumeHoverCount: 0
readonly property bool directionalEffect: Theme.isDirectionalEffect
readonly property bool depthEffect: Theme.isDepthEffect
function panelMotionX(panelWidth, active) {
if (active)
return 0;
if (directionalEffect) {
const travel = Math.max(Theme.effectAnimOffset, panelWidth * 0.85);
return isRightEdge ? -travel : travel;
}
if (depthEffect) {
const travel = Math.max(Theme.effectAnimOffset * 0.7, panelWidth * 0.32);
return isRightEdge ? -travel : travel;
}
return 0;
}
function panelMotionY(panelType, panelHeight, active) {
if (active)
return 0;
if (directionalEffect) {
if (panelType === 2)
return panelHeight * 0.08;
if (panelType === 3)
return -panelHeight * 0.08;
return 0;
}
if (depthEffect) {
if (panelType === 2)
return panelHeight * 0.04;
if (panelType === 3)
return -panelHeight * 0.04;
return 0;
}
return 0;
}
function volumeAreaEntered() {
__volumeHoverCount++;
panelEntered();
@@ -98,8 +61,8 @@ Item {
visible: dropdownType === 1 && volumeAvailable
width: 60
height: 180
x: (isRightEdge ? anchorPos.x : anchorPos.x - width) + panelMotionX(width, dropdownType === 1)
y: anchorPos.y - height / 2 + panelMotionY(1, height, dropdownType === 1)
x: isRightEdge ? anchorPos.x : anchorPos.x - width
y: anchorPos.y - height / 2
radius: Theme.cornerRadius * 2
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
@@ -126,22 +89,6 @@ Item {
}
}
Behavior on x {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.expressiveDefaultSpatial, dropdownType === 1)
easing.type: Easing.BezierSpline
easing.bezierCurve: dropdownType === 1 ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
}
}
Behavior on y {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.expressiveDefaultSpatial, dropdownType === 1)
easing.type: Easing.BezierSpline
easing.bezierCurve: dropdownType === 1 ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
}
}
ElevationShadow {
id: volumeShadowLayer
anchors.fill: parent
@@ -250,11 +197,11 @@ Item {
Rectangle {
id: audioDevicesPanel
visible: dropdownType === 2 && activePlayer !== null
visible: dropdownType === 2
width: 280
height: Math.max(200, Math.min(280, availableDevices.length * 50 + 100))
x: (isRightEdge ? anchorPos.x : anchorPos.x - width) + panelMotionX(width, dropdownType === 2)
y: anchorPos.y - height / 2 + panelMotionY(2, height, dropdownType === 2)
x: isRightEdge ? anchorPos.x : anchorPos.x - width
y: anchorPos.y - height / 2
radius: Theme.cornerRadius * 2
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.98)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.6)
@@ -281,22 +228,6 @@ Item {
}
}
Behavior on x {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.expressiveDefaultSpatial, dropdownType === 2)
easing.type: Easing.BezierSpline
easing.bezierCurve: dropdownType === 2 ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
}
}
Behavior on y {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.expressiveDefaultSpatial, dropdownType === 2)
easing.type: Easing.BezierSpline
easing.bezierCurve: dropdownType === 2 ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
}
}
ElevationShadow {
id: audioDevicesShadowLayer
anchors.fill: parent
@@ -424,8 +355,8 @@ Item {
visible: dropdownType === 3
width: 240
height: Math.max(180, Math.min(240, (allPlayers?.length || 0) * 50 + 80))
x: (isRightEdge ? anchorPos.x : anchorPos.x - width) + panelMotionX(width, dropdownType === 3)
y: anchorPos.y - height / 2 + panelMotionY(3, height, dropdownType === 3)
x: isRightEdge ? anchorPos.x : anchorPos.x - width
y: anchorPos.y - height / 2
radius: Theme.cornerRadius * 2
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.98)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.6)
@@ -452,22 +383,6 @@ Item {
}
}
Behavior on x {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.expressiveDefaultSpatial, dropdownType === 3)
easing.type: Easing.BezierSpline
easing.bezierCurve: dropdownType === 3 ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
}
}
Behavior on y {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.expressiveDefaultSpatial, dropdownType === 3)
easing.type: Easing.BezierSpline
easing.bezierCurve: dropdownType === 3 ? Theme.variantPopoutEnterCurve : Theme.variantPopoutExitCurve
}
}
ElevationShadow {
id: playersShadowLayer
anchors.fill: parent

View File

@@ -80,13 +80,13 @@ PanelWindow {
readonly property real _effectivePopoutMaxCcr: Math.max(win._effectivePopoutStartCcr, win._effectivePopoutEndCcr)
readonly property real _effectivePopoutFarExtent: Math.max(win._effectivePopoutFarStartCcr, win._effectivePopoutFarEndCcr)
readonly property real _effectiveNotifCcr: {
const isHoriz = win._notifState.barSide === "top" || win._notifState.barSide === "bottom";
const isHoriz = ConnectorGeometry.isHorizontal(win._notifState.barSide);
const crossSize = isHoriz ? _notifBodyBlurAnchor.width : _notifBodyBlurAnchor.height;
const extent = isHoriz ? _notifBodyBlurAnchor.height : _notifBodyBlurAnchor.width;
return Theme.snap(Math.max(0, Math.min(win._ccr, win._surfaceRadius, extent, crossSize / 2)), win._dpr);
}
readonly property real _effectiveNotifFarCcr: {
const isHoriz = win._notifState.barSide === "top" || win._notifState.barSide === "bottom";
const isHoriz = ConnectorGeometry.isHorizontal(win._notifState.barSide);
const crossSize = isHoriz ? _notifBodySceneBlurAnchor.width : _notifBodySceneBlurAnchor.height;
return Theme.snap(Math.max(0, Math.min(win._ccr, win._surfaceRadius, crossSize / 2)), win._dpr);
}
@@ -97,13 +97,13 @@ PanelWindow {
readonly property real _effectiveNotifMaxCcr: Math.max(win._effectiveNotifStartCcr, win._effectiveNotifEndCcr)
readonly property real _effectiveNotifFarExtent: Math.max(win._effectiveNotifFarStartCcr, win._effectiveNotifFarEndCcr)
readonly property real _effectiveModalCcr: {
const isHoriz = win._modalState.barSide === "top" || win._modalState.barSide === "bottom";
const isHoriz = ConnectorGeometry.isHorizontal(win._modalState.barSide);
const crossSize = isHoriz ? _modalBodyBlurAnchor.width : _modalBodyBlurAnchor.height;
const extent = isHoriz ? _modalBodyBlurAnchor.height : _modalBodyBlurAnchor.width;
return Theme.snap(Math.max(0, Math.min(win._ccr, win._surfaceRadius, extent, crossSize / 2)), win._dpr);
}
readonly property real _effectiveModalFarCcr: {
const isHoriz = win._modalState.barSide === "top" || win._modalState.barSide === "bottom";
const isHoriz = ConnectorGeometry.isHorizontal(win._modalState.barSide);
const crossSize = isHoriz ? _modalBodyBlurAnchor.width : _modalBodyBlurAnchor.height;
return Theme.snap(Math.max(0, Math.min(win._ccr, win._surfaceRadius, crossSize / 2)), win._dpr);
}
@@ -428,7 +428,7 @@ PanelWindow {
readonly property bool _active: win._frameActive && win._modalState.visible && win._modalState.bodyW > 0 && win._modalState.bodyH > 0
// Clamp animX/Y so the blur body shrinks toward the bar edge (same as _popoutBodyBlurAnchor).
readonly property real _dyClamp: (win._modalState.barSide === "top" || win._modalState.barSide === "bottom") ? Math.max(-win._modalState.bodyH, Math.min(win._modalState.animY, win._modalState.bodyH)) : 0
readonly property real _dyClamp: ConnectorGeometry.isHorizontal(win._modalState.barSide) ? Math.max(-win._modalState.bodyH, Math.min(win._modalState.animY, win._modalState.bodyH)) : 0
readonly property real _dxClamp: (win._modalState.barSide === "left" || win._modalState.barSide === "right") ? Math.max(-win._modalState.bodyW, Math.min(win._modalState.animX, win._modalState.bodyW)) : 0
x: _active ? Theme.snap(win._modalState.bodyX + (win._modalState.barSide === "right" ? _dxClamp : 0), win._dpr) : 0
@@ -600,11 +600,12 @@ PanelWindow {
visible: false
readonly property bool _active: _notifBodyBlurAnchor._active
readonly property var _scene: _active ? win._notifBodyScene() : null
x: _active ? Theme.snap(win._notifBodySceneX(), win._dpr) : 0
y: _active ? Theme.snap(win._notifBodySceneY(), win._dpr) : 0
width: _active ? Theme.snap(win._notifBodySceneWidth(), win._dpr) : 0
height: _active ? Theme.snap(win._notifBodySceneHeight(), win._dpr) : 0
x: _scene ? Theme.snap(_scene.x, win._dpr) : 0
y: _scene ? Theme.snap(_scene.y, win._dpr) : 0
width: _scene ? Theme.snap(_scene.width, win._dpr) : 0
height: _scene ? Theme.snap(_scene.height, win._dpr) : 0
}
Item {
@@ -963,7 +964,7 @@ PanelWindow {
function _notifSideUnderlap() {
const side = win._notifState.barSide;
return (side === "left" || side === "right") ? win._seamOverlap : 0;
return ConnectorGeometry.isVertical(side) ? win._seamOverlap : 0;
}
function _notifStartUnderlap() {
@@ -974,36 +975,26 @@ PanelWindow {
return win._notifState.omitEndConnector ? win._seamOverlap : 0;
}
function _notifBodySceneX() {
const side = win._notifState.barSide;
const isHoriz = side === "top" || side === "bottom";
if (isHoriz)
return _notifBodyBlurAnchor.x - win._notifStartUnderlap();
return _notifBodyBlurAnchor.x - (side === "left" ? win._notifSideUnderlap() : 0);
}
function _notifBodySceneY() {
const side = win._notifState.barSide;
const isHoriz = side === "top" || side === "bottom";
if (isHoriz)
return _notifBodyBlurAnchor.y;
return _notifBodyBlurAnchor.y - win._notifStartUnderlap();
}
function _notifBodySceneWidth() {
const side = win._notifState.barSide;
const isHoriz = side === "top" || side === "bottom";
if (isHoriz)
return _notifBodyBlurAnchor.width + win._notifStartUnderlap() + win._notifEndUnderlap();
return _notifBodyBlurAnchor.width + win._notifSideUnderlap();
}
function _notifBodySceneHeight() {
const side = win._notifState.barSide;
const isHoriz = side === "top" || side === "bottom";
if (isHoriz)
return _notifBodyBlurAnchor.height;
return _notifBodyBlurAnchor.height + win._notifStartUnderlap() + win._notifEndUnderlap();
// Notif body scene rect, accounting for start/end/side underlaps per bar orientation.
function _notifBodyScene() {
const isHoriz = ConnectorGeometry.isHorizontal(win._notifState.barSide);
const start = win._notifStartUnderlap();
const end = win._notifEndUnderlap();
const side = win._notifSideUnderlap();
if (isHoriz) {
return {
"x": _notifBodyBlurAnchor.x - start,
"y": _notifBodyBlurAnchor.y,
"width": _notifBodyBlurAnchor.width + start + end,
"height": _notifBodyBlurAnchor.height
};
}
return {
"x": _notifBodyBlurAnchor.x - (win._notifState.barSide === "left" ? side : 0),
"y": _notifBodyBlurAnchor.y - start,
"width": _notifBodyBlurAnchor.width + side,
"height": _notifBodyBlurAnchor.height + start + end
};
}
function _notifConnectorRadius(placement) {
@@ -1027,7 +1018,7 @@ PanelWindow {
}
function _dockFillOverlapX() {
return (win._dockState.barSide === "top" || win._dockState.barSide === "bottom") ? win._seamOverlap : 0;
return ConnectorGeometry.isHorizontal(win._dockState.barSide) ? win._seamOverlap : 0;
}
function _dockFillOverlapY() {
@@ -1035,7 +1026,7 @@ PanelWindow {
}
function _modalArcExtent() {
return (win._modalState.barSide === "top" || win._modalState.barSide === "bottom") ? _modalBodyBlurAnchor.height : _modalBodyBlurAnchor.width;
return ConnectorGeometry.isHorizontal(win._modalState.barSide) ? _modalBodyBlurAnchor.height : _modalBodyBlurAnchor.width;
}
function _modalBlurCapThickness() {
@@ -1100,28 +1091,28 @@ PanelWindow {
function _popoutShapeBodyOffsetX() {
const side = ConnectedModeState.popoutBarSide;
if (side === "top" || side === "bottom")
if (ConnectorGeometry.isHorizontal(side))
return win._effectivePopoutStartCcr;
return side === "right" ? win._effectivePopoutFarExtent : 0;
}
function _popoutShapeBodyOffsetY() {
const side = ConnectedModeState.popoutBarSide;
if (side === "top" || side === "bottom")
if (ConnectorGeometry.isHorizontal(side))
return side === "bottom" ? win._effectivePopoutFarExtent : 0;
return win._effectivePopoutStartCcr;
}
function _popoutShapeWidth() {
const side = ConnectedModeState.popoutBarSide;
if (side === "top" || side === "bottom")
if (ConnectorGeometry.isHorizontal(side))
return win._popoutClipWidth() + win._effectivePopoutStartCcr + win._effectivePopoutEndCcr;
return win._popoutClipWidth() + win._effectivePopoutFarExtent;
}
function _popoutShapeHeight() {
const side = ConnectedModeState.popoutBarSide;
if (side === "top" || side === "bottom")
if (ConnectorGeometry.isHorizontal(side))
return win._popoutClipHeight() + win._effectivePopoutFarExtent;
return win._popoutClipHeight() + win._effectivePopoutStartCcr + win._effectivePopoutEndCcr;
}
@@ -1163,7 +1154,7 @@ PanelWindow {
}
function _dockBodyXInChrome() {
return ((win._dockState.barSide === "top" || win._dockState.barSide === "bottom") ? win._dockConnectorRadius() : 0) - win._dockFillOverlapX();
return (ConnectorGeometry.isHorizontal(win._dockState.barSide) ? win._dockConnectorRadius() : 0) - win._dockFillOverlapX();
}
function _dockBodyYInChrome() {

View File

@@ -564,11 +564,16 @@ PanelWindow {
readonly property real dpr: screenValid ? CompositorService.getScreenScale(win.screen) : 1
readonly property real alignedWidth: Theme.px(Math.max(0, implicitWidth - (windowShadowPad * 2)), dpr)
readonly property real alignedHeight: renderedAlignedHeight
onScreenYChanged: popupChromeGeometryChanged()
onScreenChanged: popupChromeGeometryChanged()
onScreenYChanged: if (connectedFrameMode)
popupChromeGeometryChanged()
onScreenChanged: if (connectedFrameMode)
popupChromeGeometryChanged()
// Intentionally unconditional: Manager needs the signal when frame mode toggles off
onConnectedFrameModeChanged: popupChromeGeometryChanged()
onAlignedWidthChanged: popupChromeGeometryChanged()
onAlignedHeightChanged: popupChromeGeometryChanged()
onAlignedWidthChanged: if (connectedFrameMode)
popupChromeGeometryChanged()
onAlignedHeightChanged: if (connectedFrameMode)
popupChromeGeometryChanged()
Item {
id: content

View File

@@ -5,6 +5,7 @@ import Quickshell.Wayland
import qs.Common
import qs.Modals.DankLauncherV2
import qs.Services
import qs.Widgets
Scope {
id: niriOverviewScope
@@ -124,6 +125,19 @@ Scope {
item: overlayVisible && spotlightContainer.visible ? spotlightContainer : null
}
WindowBlur {
targetWindow: overlayWindow
// Track the container's scale so blur shrinks with the content
// during exit — otherwise blur pops away one frame after content.
readonly property real s: Math.min(1, spotlightContainer.scale)
readonly property bool active: spotlightContainer.visible && spotlightContainer.opacity > 0
blurX: spotlightContainer.x + spotlightContainer.width * (1 - s) * 0.5
blurY: spotlightContainer.y + spotlightContainer.height * (1 - s) * 0.5
blurWidth: active ? spotlightContainer.width * s : 0
blurHeight: active ? spotlightContainer.height * s : 0
blurRadius: Theme.cornerRadius
}
onShouldShowSpotlightChanged: {
if (shouldShowSpotlight) {
if (launcherContent?.controller) {
@@ -202,18 +216,8 @@ Scope {
Item {
id: spotlightContainer
readonly property bool directionalEffect: Theme.isDirectionalEffect
readonly property bool depthEffect: Theme.isDepthEffect
readonly property real collapsedMotionX: depthEffect ? Theme.effectAnimOffset * 0.25 : 0
readonly property real collapsedMotionY: {
if (directionalEffect)
return Math.max(height * 0.85, Theme.effectAnimOffset * 1.1);
if (depthEffect)
return Math.max(Theme.effectAnimOffset * 0.8, 30);
return 0;
}
x: Theme.snap((parent.width - width) / 2 + (overlayWindow.shouldShowSpotlight ? 0 : collapsedMotionX), overlayWindow.dpr)
y: Theme.snap((parent.height - height) / 2 + (overlayWindow.shouldShowSpotlight ? 0 : collapsedMotionY), overlayWindow.dpr)
x: Theme.snap((parent.width - width) / 2, overlayWindow.dpr)
y: Theme.snap((parent.height - height) / 2, overlayWindow.dpr)
readonly property int baseWidth: {
switch (SettingsData.dankLauncherV2Size) {
@@ -244,8 +248,8 @@ Scope {
readonly property bool animatingOut: niriOverviewScope.isClosing && overlayWindow.isSpotlightScreen
scale: Theme.isDirectionalEffect ? 1 : (overlayWindow.shouldShowSpotlight ? 1.0 : Theme.effectScaleCollapsed)
opacity: Theme.isDirectionalEffect ? 1 : (overlayWindow.shouldShowSpotlight ? 1 : 0)
scale: overlayWindow.shouldShowSpotlight ? 1.0 : 0.96
opacity: overlayWindow.shouldShowSpotlight ? 1 : 0
visible: overlayWindow.shouldShowSpotlight || animatingOut
enabled: overlayWindow.shouldShowSpotlight
@@ -255,11 +259,10 @@ Scope {
Behavior on scale {
id: scaleAnimation
enabled: !Theme.isDirectionalEffect
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.fast, overlayWindow.shouldShowSpotlight)
duration: Theme.expressiveDurations.fast
easing.type: Easing.BezierSpline
easing.bezierCurve: spotlightContainer.visible ? Theme.variantModalEnterCurve : Theme.variantModalExitCurve
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveFastSpatial : Theme.expressiveCurves.standardAccel
onRunningChanged: {
if (running || !spotlightContainer.animatingOut)
return;
@@ -269,27 +272,10 @@ Scope {
}
Behavior on opacity {
enabled: !Theme.isDirectionalEffect
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.fast, overlayWindow.shouldShowSpotlight)
duration: Theme.expressiveDurations.fast
easing.type: Easing.BezierSpline
easing.bezierCurve: spotlightContainer.visible ? Theme.variantModalEnterCurve : Theme.variantModalExitCurve
}
}
Behavior on x {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.fast, overlayWindow.shouldShowSpotlight)
easing.type: Easing.BezierSpline
easing.bezierCurve: spotlightContainer.visible ? Theme.variantModalEnterCurve : Theme.variantModalExitCurve
}
}
Behavior on y {
NumberAnimation {
duration: Theme.variantDuration(Theme.expressiveDurations.fast, overlayWindow.shouldShowSpotlight)
easing.type: Easing.BezierSpline
easing.bezierCurve: spotlightContainer.visible ? Theme.variantModalEnterCurve : Theme.variantModalExitCurve
easing.bezierCurve: spotlightContainer.visible ? Theme.expressiveCurves.expressiveFastSpatial : Theme.expressiveCurves.standardAccel
}
}