1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 07:22:50 -05:00

Add support for linux-wallpaperengine wallpapers (#191)

* Add support for linux-wallpaperengine wallpapers

* Remove unnecessary onCompleted hook
This commit is contained in:
Aziz Hasanain
2025-09-12 19:13:14 +03:00
committed by GitHub
parent c3759dc542
commit c8cb5dc146
6 changed files with 262 additions and 28 deletions

View File

@@ -2,8 +2,10 @@ import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Widgets
import Quickshell.Io
import qs.Common
import qs.Widgets
import qs.Modules
LazyLoader {
active: true
@@ -36,20 +38,38 @@ LazyLoader {
property bool isColorSource: source.startsWith("#")
property Image current: one
WallpaperEngineProc {
id: weProc
monitor: modelData.name
}
Component.onDestruction: {
weProc.stop()
}
onSourceChanged: {
if (!source) {
current = null
one.source = ""
two.source = ""
} else if (isColorSource) {
const isWE = source.startsWith("we:")
if (isWE) {
current = null
one.source = ""
two.source = ""
weProc.start(source.substring(3)) // strip "we:"
} else {
if (current === one)
two.update()
else
one.update()
weProc.stop()
if (!source) {
current = null
one.source = ""
two.source = ""
} else if (isColorSource) {
current = null
one.source = ""
two.source = ""
} else {
if (current === one)
two.update()
else
one.update()
}
}
}