1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -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

@@ -62,6 +62,7 @@ Singleton {
property bool lockBeforeSuspend: false property bool lockBeforeSuspend: false
Component.onCompleted: { Component.onCompleted: {
loadSettings() loadSettings()
} }

View File

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

View File

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