mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
meta: more shadows, do not use QT 6.9 RectangularShadow
This commit is contained in:
@@ -224,7 +224,6 @@ PanelWindow {
|
|||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
||||||
layer.textureMirroring: ShaderEffectSource.NoMirroring
|
|
||||||
opacity: root.shouldBeVisible ? 1 : 0
|
opacity: root.shouldBeVisible ? 1 : 0
|
||||||
scale: modalContainer.scaleValue
|
scale: modalContainer.scaleValue
|
||||||
x: Theme.snap(modalContainer.animX + (parent.width - width) * (1 - modalContainer.scaleValue) * 0.5, root.dpr)
|
x: Theme.snap(modalContainer.animX + (parent.width - width) * (1 - modalContainer.scaleValue) * 0.5, root.dpr)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
pragma ComponentBehavior
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
|
import QtQuick.Shapes
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
@@ -198,65 +199,82 @@ PanelWindow {
|
|||||||
return Theme.popupDistance
|
return Theme.popupDistance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property real dpr: CompositorService.getScreenScale(win.screen)
|
||||||
|
readonly property real alignedWidth: Theme.px(implicitWidth, dpr)
|
||||||
|
readonly property real alignedHeight: Theme.px(implicitHeight, dpr)
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
anchors.fill: parent
|
x: Theme.snap((win.width - alignedWidth) / 2, dpr)
|
||||||
|
y: Theme.snap((win.height - alignedHeight) / 2, dpr)
|
||||||
|
width: alignedWidth
|
||||||
|
height: alignedHeight
|
||||||
visible: win.hasValidData
|
visible: win.hasValidData
|
||||||
layer.enabled: true
|
|
||||||
layer.smooth: true
|
|
||||||
|
|
||||||
Rectangle {
|
property real shadowBlurPx: 10
|
||||||
property var shadowLayers: [shadowLayer1, shadowLayer2, shadowLayer3]
|
property real shadowSpreadPx: 0
|
||||||
|
property real shadowBaseAlpha: 0.60
|
||||||
|
readonly property real popupSurfaceAlpha: SettingsData.popupTransparency
|
||||||
|
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha))
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: bgShadowLayer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 4
|
anchors.margins: Theme.snap(4, win.dpr)
|
||||||
radius: Theme.cornerRadius
|
visible: content.popupSurfaceAlpha >= 0.95
|
||||||
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
layer.enabled: true
|
||||||
border.color: notificationData && notificationData.urgency === NotificationUrgency.Critical ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3) : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
layer.smooth: false
|
||||||
border.width: notificationData && notificationData.urgency === NotificationUrgency.Critical ? 2 : 0
|
layer.textureSize: Qt.size(Math.round(width * win.dpr), Math.round(height * win.dpr))
|
||||||
clip: true
|
layer.textureMirroring: ShaderEffectSource.MirrorVertically
|
||||||
|
|
||||||
Rectangle {
|
layer.effect: MultiEffect {
|
||||||
id: shadowLayer1
|
id: shadowFx
|
||||||
|
autoPaddingEnabled: true
|
||||||
anchors.fill: parent
|
shadowEnabled: true
|
||||||
anchors.margins: -3
|
blurEnabled: false
|
||||||
color: "transparent"
|
maskEnabled: false
|
||||||
radius: parent.radius + 3
|
property int blurMax: 64
|
||||||
border.color: Qt.rgba(0, 0, 0, 0.05)
|
shadowBlur: Math.max(0, Math.min(1, content.shadowBlurPx / blurMax))
|
||||||
border.width: 1
|
shadowScale: 1 + (2 * content.shadowSpreadPx) / Math.max(1, Math.min(bgShadowLayer.width, bgShadowLayer.height))
|
||||||
z: -3
|
shadowColor: Qt.rgba(0, 0, 0, content.effectiveShadowAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Shape {
|
||||||
id: shadowLayer2
|
id: backgroundShape
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -2
|
preferredRendererType: Shape.CurveRenderer
|
||||||
color: "transparent"
|
|
||||||
radius: parent.radius + 2
|
|
||||||
border.color: Qt.rgba(0, 0, 0, 0.08)
|
|
||||||
border.width: 1
|
|
||||||
z: -2
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
readonly property real radius: Theme.cornerRadius
|
||||||
id: shadowLayer3
|
readonly property color fillColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
|
readonly property color strokeColor: notificationData && notificationData.urgency === NotificationUrgency.Critical ? Theme.withAlpha(Theme.primary, 0.3) : Theme.withAlpha(Theme.outline, 0.08)
|
||||||
|
readonly property real strokeWidth: notificationData && notificationData.urgency === NotificationUrgency.Critical ? 2 : 0
|
||||||
|
|
||||||
anchors.fill: parent
|
ShapePath {
|
||||||
color: "transparent"
|
fillColor: backgroundShape.fillColor
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
strokeColor: backgroundShape.strokeColor
|
||||||
border.width: 1
|
strokeWidth: backgroundShape.strokeWidth
|
||||||
radius: parent.radius
|
|
||||||
z: -1
|
startX: backgroundShape.radius
|
||||||
|
startY: 0
|
||||||
|
|
||||||
|
PathLine { x: backgroundShape.width - backgroundShape.radius; y: 0 }
|
||||||
|
PathQuad { x: backgroundShape.width; y: backgroundShape.radius; controlX: backgroundShape.width; controlY: 0 }
|
||||||
|
PathLine { x: backgroundShape.width; y: backgroundShape.height - backgroundShape.radius }
|
||||||
|
PathQuad { x: backgroundShape.width - backgroundShape.radius; y: backgroundShape.height; controlX: backgroundShape.width; controlY: backgroundShape.height }
|
||||||
|
PathLine { x: backgroundShape.radius; y: backgroundShape.height }
|
||||||
|
PathQuad { x: 0; y: backgroundShape.height - backgroundShape.radius; controlX: 0; controlY: backgroundShape.height }
|
||||||
|
PathLine { x: 0; y: backgroundShape.radius }
|
||||||
|
PathQuad { x: backgroundShape.radius; y: 0; controlX: 0; controlY: 0 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: parent.radius
|
radius: backgroundShape.radius
|
||||||
visible: notificationData && notificationData.urgency === NotificationUrgency.Critical
|
visible: notificationData && notificationData.urgency === NotificationUrgency.Critical
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
clip: true
|
||||||
|
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
orientation: Gradient.Horizontal
|
orientation: Gradient.Horizontal
|
||||||
@@ -277,6 +295,13 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: backgroundContainer
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.snap(4, win.dpr)
|
||||||
|
clip: true
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: notificationContent
|
id: notificationContent
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Singleton {
|
|||||||
function getScreenScale(screen) {
|
function getScreenScale(screen) {
|
||||||
if (!screen) return 1
|
if (!screen) return 1
|
||||||
|
|
||||||
if (Quickshell.env("QT_WAYLAND_FORCE_DPI")) {
|
if (Quickshell.env("QT_WAYLAND_FORCE_DPI") || Quickshell.env("QT_SCALE_FACTOR")) {
|
||||||
return screen.devicePixelRatio || 1
|
return screen.devicePixelRatio || 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
pragma ComponentBehavior
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
pragma ComponentBehavior
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
pragma ComponentBehavior
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Quickshell
|
|||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
@@ -117,14 +118,37 @@ PanelWindow {
|
|||||||
scale: shouldBeVisible ? 1 : 0.9
|
scale: shouldBeVisible ? 1 : 0.9
|
||||||
|
|
||||||
property bool childHovered: false
|
property bool childHovered: false
|
||||||
|
property real shadowBlurPx: 10
|
||||||
|
property real shadowSpreadPx: 0
|
||||||
|
property real shadowBaseAlpha: 0.60
|
||||||
|
readonly property real popupSurfaceAlpha: SettingsData.popupTransparency
|
||||||
|
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha * osdContainer.opacity))
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: osdBackground
|
id: bgShadowLayer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
visible: osdContainer.popupSurfaceAlpha >= 0.95
|
||||||
radius: Theme.cornerRadius
|
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
layer.smooth: false
|
||||||
border.width: 1
|
layer.textureSize: Qt.size(Math.round(width * root.dpr), Math.round(height * root.dpr))
|
||||||
|
layer.textureMirroring: ShaderEffectSource.MirrorVertically
|
||||||
|
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
id: shadowFx
|
||||||
|
autoPaddingEnabled: true
|
||||||
|
shadowEnabled: true
|
||||||
|
blurEnabled: false
|
||||||
|
maskEnabled: false
|
||||||
|
property int blurMax: 64
|
||||||
|
shadowBlur: Math.max(0, Math.min(1, osdContainer.shadowBlurPx / blurMax))
|
||||||
|
shadowScale: 1 + (2 * osdContainer.shadowSpreadPx) / Math.max(1, Math.min(bgShadowLayer.width, bgShadowLayer.height))
|
||||||
|
shadowColor: Qt.rgba(0, 0, 0, osdContainer.effectiveShadowAlpha)
|
||||||
|
}
|
||||||
|
|
||||||
|
DankRectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -162,6 +186,6 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
item: osdBackground
|
item: bgShadowLayer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,38 +170,23 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RectangularShadow {
|
|
||||||
id: shadowEffect
|
|
||||||
width: contentLoaderWrapper.width
|
|
||||||
height: contentLoaderWrapper.height
|
|
||||||
x: contentLoaderWrapper.x
|
|
||||||
y: contentLoaderWrapper.y
|
|
||||||
scale: contentLoaderWrapper.scale
|
|
||||||
transformOrigin: Item.Center
|
|
||||||
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
blur: 10
|
|
||||||
spread: 0
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.6)
|
|
||||||
visible: contentLoaderWrapper.visible && shouldBeVisible
|
|
||||||
opacity: contentLoaderWrapper.opacity * 0.6
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: contentLoaderWrapper
|
id: contentWrapper
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
|
||||||
layer.smooth: false
|
|
||||||
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
|
||||||
layer.textureMirroring: ShaderEffectSource.NoMirroring
|
|
||||||
opacity: shouldBeVisible ? 1 : 0
|
opacity: shouldBeVisible ? 1 : 0
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
scale: contentContainer.scaleValue
|
scale: contentContainer.scaleValue
|
||||||
x: Theme.snap(contentContainer.animX + (parent.width - width) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
|
x: Theme.snap(contentContainer.animX + (parent.width - width) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
|
||||||
y: Theme.snap(contentContainer.animY + (parent.height - height) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
|
y: Theme.snap(contentContainer.animY + (parent.height - height) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
|
||||||
|
|
||||||
|
property real shadowBlurPx: 10
|
||||||
|
property real shadowSpreadPx: 0
|
||||||
|
property real shadowBaseAlpha: 0.60
|
||||||
|
readonly property real popupSurfaceAlpha: SettingsData.popupTransparency
|
||||||
|
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha * contentWrapper.opacity))
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: animationDuration
|
duration: animationDuration
|
||||||
@@ -210,15 +195,45 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankRectangle {
|
Item {
|
||||||
|
id: bgShadowLayer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
visible: contentWrapper.popupSurfaceAlpha >= 0.95
|
||||||
|
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
||||||
|
layer.smooth: false
|
||||||
|
layer.textureSize: Qt.size(Math.round(width * root.dpr), Math.round(height * root.dpr))
|
||||||
|
layer.textureMirroring: ShaderEffectSource.MirrorVertically
|
||||||
|
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
id: shadowFx
|
||||||
|
autoPaddingEnabled: true
|
||||||
|
shadowEnabled: true
|
||||||
|
blurEnabled: false
|
||||||
|
maskEnabled: false
|
||||||
|
property int blurMax: 64
|
||||||
|
shadowBlur: Math.max(0, Math.min(1, contentWrapper.shadowBlurPx / blurMax))
|
||||||
|
shadowScale: 1 + (2 * contentWrapper.shadowSpreadPx) / Math.max(1, Math.min(bgShadowLayer.width, bgShadowLayer.height))
|
||||||
|
shadowColor: Qt.rgba(0, 0, 0, contentWrapper.effectiveShadowAlpha)
|
||||||
|
}
|
||||||
|
|
||||||
|
DankRectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Item {
|
||||||
id: contentLoader
|
id: contentLoaderWrapper
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: root.visible
|
x: Theme.snap(x, root.dpr)
|
||||||
asynchronous: false
|
y: Theme.snap(y, root.dpr)
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: contentLoader
|
||||||
|
anchors.fill: parent
|
||||||
|
active: root.visible
|
||||||
|
asynchronous: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ PanelWindow {
|
|||||||
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
||||||
layer.smooth: false
|
layer.smooth: false
|
||||||
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
||||||
layer.textureMirroring: ShaderEffectSource.NoMirroring
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|||||||
@@ -1172,7 +1172,7 @@
|
|||||||
{
|
{
|
||||||
"term": "Dismiss",
|
"term": "Dismiss",
|
||||||
"context": "Dismiss",
|
"context": "Dismiss",
|
||||||
"reference": "Modules/Notifications/Popup/NotificationPopup.qml:24, Modules/Notifications/Center/NotificationCard.qml:543, Modules/Notifications/Center/NotificationCard.qml:636",
|
"reference": "Modules/Notifications/Popup/NotificationPopup.qml:25, Modules/Notifications/Center/NotificationCard.qml:543, Modules/Notifications/Center/NotificationCard.qml:636",
|
||||||
"comment": ""
|
"comment": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user