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

Add none as a wallpaper transition type

This commit is contained in:
bbedward
2025-09-22 18:57:03 -04:00
parent cf5dec733d
commit 4468e4c6af
3 changed files with 78 additions and 61 deletions

View File

@@ -806,6 +806,7 @@ Item {
description: "Visual effect used when wallpaper changes"
currentValue: {
switch (SessionData.wallpaperTransition) {
case "none": return "None"
case "fade": return "Fade"
case "wipe": return "Wipe"
case "disc": return "Disc"
@@ -816,7 +817,7 @@ Item {
default: return "Fade"
}
}
options: ["Fade", "Wipe", "Disc", "Stripes", "Iris Bloom", "Pixelate", "Portal"]
options: ["None", "Fade", "Wipe", "Disc", "Stripes", "Iris Bloom", "Pixelate", "Portal"]
onValueChanged: value => {
var transition = value.toLowerCase()
SessionData.setWallpaperTransition(transition)

View File

@@ -37,6 +37,9 @@ LazyLoader {
property string source: SessionData.getMonitorWallpaper(modelData.name) || ""
property bool isColorSource: source.startsWith("#")
property string transitionType: SessionData.wallpaperTransition
onTransitionTypeChanged: {
currentWallpaper.visible = (transitionType === "none")
}
property real transitionProgress: 0
property real fillMode: 1.0
property vector4d fillColor: Qt.vector4d(0, 0, 0, 1)
@@ -58,6 +61,7 @@ LazyLoader {
monitor: modelData.name
}
Component.onDestruction: {
weProc.stop()
}
@@ -76,7 +80,12 @@ LazyLoader {
} else if (isColor) {
setWallpaperImmediate("")
} else {
changeWallpaper(source.startsWith("file://") ? source : "file://" + source)
// Always set immediately if there's no current wallpaper (startup)
if (!currentWallpaper.source) {
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source)
} else {
changeWallpaper(source.startsWith("file://") ? source : "file://" + source)
}
}
}
}
@@ -88,8 +97,8 @@ LazyLoader {
nextWallpaper.source = ""
}
function changeWallpaper(newPath) {
if (newPath === currentWallpaper.source) return
function changeWallpaper(newPath, force) {
if (!force && newPath === currentWallpaper.source) return
if (!newPath || newPath.startsWith("#")) return
if (root.transitioning) {
@@ -99,6 +108,18 @@ LazyLoader {
nextWallpaper.source = ""
}
// If no current wallpaper, set immediately to avoid scaling issues
if (!currentWallpaper.source) {
setWallpaperImmediate(newPath)
return
}
// If transition is "none", set immediately
if (root.transitionType === "none") {
setWallpaperImmediate(newPath)
return
}
if (root.transitionType === "wipe") {
root.wipeDirection = Math.random() * 4
} else if (root.transitionType === "disc") {
@@ -111,17 +132,12 @@ LazyLoader {
nextWallpaper.source = newPath
if (currentWallpaper.source) {
if (nextWallpaper.status === Image.Ready) {
transitionAnimation.start()
}
} else {
if (nextWallpaper.status === Image.Ready) {
transitionAnimation.start()
}
if (nextWallpaper.status === Image.Ready) {
transitionAnimation.start()
}
}
Loader {
anchors.fill: parent
active: !root.source || root.isColorSource
@@ -149,9 +165,9 @@ LazyLoader {
Image {
id: currentWallpaper
anchors.fill: parent
visible: true
opacity: 0
layer.enabled: true
visible: root.transitionType === "none"
opacity: 1
layer.enabled: false
asynchronous: true
smooth: true
cache: true
@@ -161,9 +177,9 @@ LazyLoader {
Image {
id: nextWallpaper
anchors.fill: parent
visible: true
visible: false
opacity: 0
layer.enabled: true
layer.enabled: false
asynchronous: true
smooth: true
cache: true
@@ -172,21 +188,16 @@ LazyLoader {
onStatusChanged: {
if (status !== Image.Ready) return
if (currentWallpaper.source) {
if (!root.transitioning && root.transitionType !== "none") {
transitionAnimation.start()
} else if (root.transitionType === "none") {
currentWallpaper.source = source
nextWallpaper.source = ""
root.transitionProgress = 0.0
}
if (root.transitionType === "none") {
currentWallpaper.source = source
nextWallpaper.source = ""
root.transitionProgress = 0.0
} else {
if (!root.transitioning && root.transitionType !== "none") {
currentWallpaper.layer.enabled = true
layer.enabled = true
visible = true
if (!root.transitioning) {
transitionAnimation.start()
} else if (root.transitionType === "none") {
currentWallpaper.source = source
nextWallpaper.source = ""
root.transitionProgress = 0.0
}
}
}
@@ -195,19 +206,19 @@ LazyLoader {
ShaderEffect {
id: fadeShader
anchors.fill: parent
visible: (root.transitionType === "fade" || root.transitionType === "none") && (root.hasCurrent || root.booting)
visible: root.transitionType === "fade" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_fade.frag.qsb")
}
@@ -224,12 +235,12 @@ LazyLoader {
property real direction: root.wipeDirection
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_wipe.frag.qsb")
}
@@ -248,12 +259,12 @@ LazyLoader {
property real centerY: root.discCenterY
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_disc.frag.qsb")
}
@@ -272,12 +283,12 @@ LazyLoader {
property real angle: root.stripesAngle
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_stripes.frag.qsb")
}
@@ -285,7 +296,7 @@ LazyLoader {
ShaderEffect {
id: irisBloomShader
anchors.fill: parent
visible: (root.transitionType === "iris bloom" || root.transitionType === "none") && (root.hasCurrent || root.booting)
visible: root.transitionType === "iris bloom" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
@@ -296,12 +307,12 @@ LazyLoader {
property real aspectRatio: root.width / root.height
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_iris_bloom.frag.qsb")
}
@@ -317,12 +328,12 @@ LazyLoader {
property real smoothness: root.edgeSmoothness // controls starting block size
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
property real centerX: root.discCenterX
property real centerY: root.discCenterY
property real aspectRatio: root.width / root.height
@@ -344,12 +355,12 @@ LazyLoader {
property real centerY: root.discCenterY
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : height)
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
property real imageHeight1: Math.max(1, root.hasCurrent ? source1.sourceSize.height : modelData.height)
property real imageWidth2: Math.max(1, source2.sourceSize.width)
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: width
property real screenHeight: height
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_portal.frag.qsb")
}
@@ -360,7 +371,7 @@ LazyLoader {
property: "transitionProgress"
from: 0.0
to: 1.0
duration: 1000
duration: root.transitionType === "none" ? 0 : 1000
easing.type: Easing.InOutCubic
onFinished: {
Qt.callLater(() => {
@@ -368,6 +379,10 @@ LazyLoader {
currentWallpaper.source = nextWallpaper.source
}
nextWallpaper.source = ""
nextWallpaper.visible = false
currentWallpaper.visible = root.transitionType === "none"
currentWallpaper.layer.enabled = false
nextWallpaper.layer.enabled = false
root.transitionProgress = 0.0
})
}