1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 02:52:07 -04:00
This commit is contained in:
bbedward
2026-05-01 17:06:27 -04:00
committed by purian23
parent e876ddc0b9
commit 3796b3e1b5
3 changed files with 62 additions and 29 deletions

View File

@@ -2,15 +2,23 @@ pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import Quickshell import Quickshell
import qs.Common
Variants { Variants {
id: root id: root
model: Quickshell.screens model: Quickshell.screens
FrameInstance { delegate: Loader {
id: instanceLoader
required property var modelData required property var modelData
screen: modelData active: SettingsData.frameEnabled && SettingsData.isScreenInPreferences(instanceLoader.modelData, SettingsData.frameScreenPreferences)
asynchronous: false
sourceComponent: FrameInstance {
screen: instanceLoader.modelData
}
} }
} }

View File

@@ -12,6 +12,8 @@ import "../../Common/ConnectorGeometry.js" as ConnectorGeometry
PanelWindow { PanelWindow {
id: win id: win
readonly property var log: Log.scoped("FrameWindow")
required property var targetScreen required property var targetScreen
screen: targetScreen screen: targetScreen
@@ -1221,7 +1223,7 @@ PanelWindow {
} }
win.BackgroundEffect.blurRegion = _staticBlurRegion; win.BackgroundEffect.blurRegion = _staticBlurRegion;
} catch (e) { } catch (e) {
console.warn("FrameWindow: Failed to set blur region:", e); win.log.warn("Failed to set blur region:", e);
} }
} }
@@ -1231,62 +1233,70 @@ PanelWindow {
} catch (e) {} } catch (e) {}
} }
Timer { // Coalesce bursts of settings-change signals into a single _buildBlur() call
id: _blurRebuildTimer // on the next event loop tick.
interval: 1 property bool _blurRebuildPending: false
onTriggered: win._buildBlur() function _scheduleBlurRebuild() {
if (_blurRebuildPending)
return;
_blurRebuildPending = true;
Qt.callLater(_runBlurRebuild);
}
function _runBlurRebuild() {
_blurRebuildPending = false;
win._buildBlur();
} }
Connections { Connections {
target: SettingsData target: SettingsData
function onFrameBlurEnabledChanged() { function onFrameBlurEnabledChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameEnabledChanged() { function onFrameEnabledChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameThicknessChanged() { function onFrameThicknessChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameBarSizeChanged() { function onFrameBarSizeChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameOpacityChanged() { function onFrameOpacityChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameRoundingChanged() { function onFrameRoundingChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameScreenPreferencesChanged() { function onFrameScreenPreferencesChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onBarConfigsChanged() { function onBarConfigsChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onConnectedFrameModeActiveChanged() { function onConnectedFrameModeActiveChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
function onFrameCloseGapsChanged() { function onFrameCloseGapsChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
} }
Connections { Connections {
target: BlurService target: BlurService
function onEnabledChanged() { function onEnabledChanged() {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} }
} }
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
_blurRebuildTimer.restart(); win._scheduleBlurRebuild();
} else { } else {
_teardownBlur(); _teardownBlur();
} }
} }
Component.onCompleted: _blurRebuildTimer.restart() Component.onCompleted: win._scheduleBlurRebuild()
Component.onDestruction: win._teardownBlur() Component.onDestruction: win._teardownBlur()
FrameBorder { FrameBorder {

View File

@@ -7,6 +7,8 @@ import qs.Services
Item { Item {
id: root id: root
readonly property var log: Log.scoped("DankPopoutStandalone")
property var popoutHandle: root property var popoutHandle: root
property string layerNamespace: "dms:popout" property string layerNamespace: "dms:popout"
property alias content: contentLoader.sourceComponent property alias content: contentLoader.sourceComponent
@@ -214,6 +216,17 @@ Item {
} }
} }
// Forces contentWindow to render a frame so Quickshell ships the updated
// WindowBlur region to the compositor. WindowBlur's property updates
// don't dirty the QML scene graph by themselves, so when the popup grows,
// shrinks, or closes without an animation running, the blur state can
// get stuck at its previous size. Called from the existing
// onAligned*Changed / onShouldBeVisibleChanged handlers.
function _kickBlurCommit() {
if (typeof contentWindow.update === "function")
contentWindow.update();
}
function _setSettledSurfaceGeometry() { function _setSettledSurfaceGeometry() {
if (shouldBeVisible) { if (shouldBeVisible) {
_setSurfaceGeometry(alignedX, alignedY, alignedWidth, alignedHeight); _setSurfaceGeometry(alignedX, alignedY, alignedWidth, alignedHeight);
@@ -247,16 +260,19 @@ Item {
onAlignedXChanged: { onAlignedXChanged: {
if (shouldBeVisible) if (shouldBeVisible)
_setAnimatedSurfaceEnvelope(); _setAnimatedSurfaceEnvelope();
_kickBlurCommit();
} }
onAlignedYChanged: { onAlignedYChanged: {
if (shouldBeVisible) if (shouldBeVisible)
_setAnimatedSurfaceEnvelope(); _setAnimatedSurfaceEnvelope();
_kickBlurCommit();
} }
onAlignedWidthChanged: { onAlignedWidthChanged: {
if (shouldBeVisible) if (shouldBeVisible)
_setAnimatedSurfaceEnvelope(); _setAnimatedSurfaceEnvelope();
_kickBlurCommit();
} }
function open() { function open() {
@@ -378,12 +394,14 @@ Item {
onAlignedHeightChanged: { onAlignedHeightChanged: {
if (shouldBeVisible) if (shouldBeVisible)
_setAnimatedSurfaceEnvelope(); _setAnimatedSurfaceEnvelope();
_kickBlurCommit();
if (!suspendShadowWhileResizing || !shouldBeVisible) if (!suspendShadowWhileResizing || !shouldBeVisible)
return; return;
_resizeActive = true; _resizeActive = true;
resizeSettleTimer.restart(); resizeSettleTimer.restart();
} }
onShouldBeVisibleChanged: { onShouldBeVisibleChanged: {
_kickBlurCommit();
if (!shouldBeVisible) { if (!shouldBeVisible) {
_resizeActive = false; _resizeActive = false;
resizeSettleTimer.stop(); resizeSettleTimer.stop();
@@ -566,10 +584,10 @@ Item {
WlrLayershell.layer: { WlrLayershell.layer: {
switch (Quickshell.env("DMS_POPOUT_LAYER")) { switch (Quickshell.env("DMS_POPOUT_LAYER")) {
case "bottom": case "bottom":
console.warn("DankPopout: 'bottom' layer is not valid for popouts. Defaulting to 'top' layer."); root.log.warn("'bottom' layer is not valid for popouts. Defaulting to 'top' layer.");
return WlrLayershell.Top; return WlrLayershell.Top;
case "background": case "background":
console.warn("DankPopout: 'background' layer is not valid for popouts. Defaulting to 'top' layer."); root.log.warn("'background' layer is not valid for popouts. Defaulting to 'top' layer.");
return WlrLayershell.Top; return WlrLayershell.Top;
case "overlay": case "overlay":
return WlrLayershell.Overlay; return WlrLayershell.Overlay;
@@ -800,12 +818,10 @@ Item {
width: rollOutAdjuster.baseWidth width: rollOutAdjuster.baseWidth
height: rollOutAdjuster.baseHeight height: rollOutAdjuster.baseHeight
// _renderActive pins visibility/layer for the full transition; flipped true on shouldBeVisible rising, // publishedOpacity tracks Item.opacity on the GUI thread so consumers (WindowBlur,
// false only after the close animation completes. publishedOpacity tracks Item.opacity but on the GUI // ElevationShadow, sibling rect) see interpolated values while the visual runs on
// thread so consumers (WindowBlur, ElevationShadow, sibling rect) see interpolated values while the // the render thread via OpacityAnimator.
// visual runs on the render thread via OpacityAnimator.
property bool _renderActive: Theme.isDirectionalEffect || shouldBeVisible property bool _renderActive: Theme.isDirectionalEffect || shouldBeVisible
property bool _animating: false
property real publishedOpacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0) property real publishedOpacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0)
opacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0) opacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0)
@@ -815,7 +831,7 @@ Item {
x: Theme.snap(contentContainer.animX + (rollOutAdjuster.baseWidth - width) * (1 - contentContainer.scaleValue) * 0.5, root.dpr) x: Theme.snap(contentContainer.animX + (rollOutAdjuster.baseWidth - width) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
y: Theme.snap(contentContainer.animY + (rollOutAdjuster.baseHeight - height) * (1 - contentContainer.scaleValue) * 0.5, root.dpr) y: Theme.snap(contentContainer.animY + (rollOutAdjuster.baseHeight - height) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
layer.enabled: _animating || (!Theme.isDirectionalEffect && publishedOpacity < 1) layer.enabled: !Theme.isDirectionalEffect && publishedOpacity < 1
layer.smooth: false layer.smooth: false
layer.textureSize: root.dpr > 1 ? Qt.size(Math.ceil(width * root.dpr), Math.ceil(height * root.dpr)) : Qt.size(0, 0) layer.textureSize: root.dpr > 1 ? Qt.size(Math.ceil(width * root.dpr), Math.ceil(height * root.dpr)) : Qt.size(0, 0)
@@ -826,7 +842,6 @@ Item {
easing.type: Easing.BezierSpline easing.type: Easing.BezierSpline
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
onRunningChanged: { onRunningChanged: {
contentWrapper._animating = running;
if (!running && !root.shouldBeVisible) if (!running && !root.shouldBeVisible)
contentWrapper._renderActive = false; contentWrapper._renderActive = false;
} }