1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -05:00

meta: replace rectangles with DankRectangle shapes

This commit is contained in:
bbedward
2025-11-10 16:16:25 -05:00
parent 201a7e3b34
commit 471938adb6
12 changed files with 97 additions and 429 deletions

View File

@@ -5,6 +5,7 @@ import Quickshell.Hyprland
import Quickshell.Wayland
import qs.Common
import qs.Services
import qs.Widgets
PanelWindow {
id: root
@@ -171,28 +172,26 @@ PanelWindow {
RectangularShadow {
id: shadowEffect
width: contentLoader.width
height: contentLoader.height
x: contentLoader.x
y: contentLoader.y
scale: contentLoader.scale
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: contentLoader.visible && shouldBeVisible
opacity: contentLoader.opacity * 0.6
visible: contentLoaderWrapper.visible && shouldBeVisible
opacity: contentLoaderWrapper.opacity * 0.6
}
Loader {
id: contentLoader
Item {
id: contentLoaderWrapper
anchors.centerIn: parent
width: parent.width
height: parent.height
active: root.visible
asynchronous: false
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)
@@ -210,6 +209,17 @@ PanelWindow {
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
}
}
DankRectangle {
anchors.fill: parent
}
Loader {
id: contentLoader
anchors.fill: parent
active: root.visible
asynchronous: false
}
}
}

54
Widgets/DankRectangle.qml Normal file
View File

@@ -0,0 +1,54 @@
import QtQuick
import QtQuick.Shapes
import qs.Common
Item {
id: root
property color color: Theme.surfaceContainer
property color borderColor: Theme.outlineMedium
property real borderWidth: 1
property real radius: Theme.cornerRadius
property color overlayColor: "transparent"
Shape {
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: root.color
strokeColor: root.borderColor
strokeWidth: root.borderWidth
startX: root.radius
startY: 0
PathLine { x: root.width - root.radius; y: 0 }
PathQuad { x: root.width; y: root.radius; controlX: root.width; controlY: 0 }
PathLine { x: root.width; y: root.height - root.radius }
PathQuad { x: root.width - root.radius; y: root.height; controlX: root.width; controlY: root.height }
PathLine { x: root.radius; y: root.height }
PathQuad { x: 0; y: root.height - root.radius; controlX: 0; controlY: root.height }
PathLine { x: 0; y: root.radius }
PathQuad { x: root.radius; y: 0; controlX: 0; controlY: 0 }
}
ShapePath {
fillColor: root.overlayColor
strokeColor: "transparent"
strokeWidth: 0
startX: root.radius
startY: 0
PathLine { x: root.width - root.radius; y: 0 }
PathQuad { x: root.width; y: root.radius; controlX: root.width; controlY: 0 }
PathLine { x: root.width; y: root.height - root.radius }
PathQuad { x: root.width - root.radius; y: root.height; controlX: root.width; controlY: root.height }
PathLine { x: root.radius; y: root.height }
PathQuad { x: 0; y: root.height - root.radius; controlX: 0; controlY: root.height }
PathLine { x: 0; y: root.radius }
PathQuad { x: root.radius; y: 0; controlX: 0; controlY: 0 }
}
}
}

View File

@@ -110,7 +110,7 @@ PanelWindow {
}
}
StyledRect {
Item {
id: contentRect
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
layer.smooth: false
@@ -121,11 +121,12 @@ PanelWindow {
anchors.bottom: parent.bottom
width: parent.width
x: Theme.snap(slideContainer.slideOffset, root.dpr)
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b,
customTransparency >= 0 ? customTransparency : SettingsData.popupTransparency)
border.color: Theme.outlineMedium
border.width: 1
radius: Theme.cornerRadius
DankRectangle {
anchors.fill: parent
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b,
customTransparency >= 0 ? customTransparency : SettingsData.popupTransparency)
}
Column {
id: headerColumn