1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 14:32:52 -05:00

Remove wallpaper engine support in favor of plugin (#601)

* Remove wallpaper engine support in favor of plugin

* i18n: update source strings from codebase

* Add migration notification for WallpaperEngine support

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Aziz Hasanain
2025-11-02 21:44:06 +03:00
committed by GitHub
parent 113ac42814
commit 414ce5610d
12 changed files with 111 additions and 307 deletions

View File

@@ -76,11 +76,6 @@ Variants {
}
}
WallpaperEngineProc {
id: weProc
monitor: modelData.name
}
Component.onCompleted: {
if (source) {
const formattedSource = source.startsWith("file://") ? source : "file://" + source
@@ -89,34 +84,23 @@ Variants {
isInitialized = true
}
Component.onDestruction: {
weProc.stop()
}
property bool isInitialized: false
property real transitionProgress: 0
readonly property bool transitioning: transitionAnimation.running
onSourceChanged: {
const isWE = source.startsWith("we:")
const isColor = source.startsWith("#")
if (isWE) {
if (!source) {
setWallpaperImmediate("")
} else if (isColor) {
setWallpaperImmediate("")
weProc.start(source.substring(3))
} else {
weProc.stop()
if (!source) {
setWallpaperImmediate("")
} else if (isColor) {
setWallpaperImmediate("")
if (!isInitialized || !currentWallpaper.source) {
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source)
isInitialized = true
} else {
if (!isInitialized || !currentWallpaper.source) {
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source)
isInitialized = true
} else {
changeWallpaper(source.startsWith("file://") ? source : "file://" + source)
}
changeWallpaper(source.startsWith("file://") ? source : "file://" + source)
}
}
}

View File

@@ -202,7 +202,7 @@ Item {
function loadWallpaperDirectory() {
const currentWallpaper = getCurrentWallpaper()
if (!currentWallpaper || currentWallpaper.startsWith("#") || currentWallpaper.startsWith("we:")) {
if (!currentWallpaper || currentWallpaper.startsWith("#")) {
if (CacheData.wallpaperLastPath && CacheData.wallpaperLastPath !== "") {
wallpaperDir = CacheData.wallpaperLastPath
} else {

View File

@@ -147,12 +147,6 @@ Item {
anchors.fill: parent
source: {
var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
if (screenName && currentWallpaper && currentWallpaper.startsWith("we:")) {
const cacheHome = StandardPaths.writableLocation(StandardPaths.GenericCacheLocation).toString()
const baseDir = Paths.strip(cacheHome)
const screenshotPath = baseDir + "/DankMaterialShell/we_screenshots" + "/" + currentWallpaper.substring(3) + ".jpg"
return screenshotPath
}
return (currentWallpaper && !currentWallpaper.startsWith("#")) ? currentWallpaper : ""
}
fillMode: Theme.getFillMode(SettingsData.wallpaperFillMode)

View File

@@ -157,12 +157,6 @@ Item {
anchors.fill: parent
source: {
var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
if (screenName && currentWallpaper && currentWallpaper.startsWith("we:")) {
const cacheHome = StandardPaths.writableLocation(StandardPaths.GenericCacheLocation).toString()
const baseDir = Paths.strip(cacheHome)
const screenshotPath = baseDir + "/DankMaterialShell/we_screenshots" + "/" + currentWallpaper.substring(3) + ".jpg"
return screenshotPath
}
return (currentWallpaper && !currentWallpaper.startsWith("#")) ? currentWallpaper : ""
}
fillMode: Theme.getFillMode(SettingsData.wallpaperFillMode)

View File

@@ -130,27 +130,10 @@ Item {
CachingImage {
anchors.fill: parent
anchors.margins: 1
property var weExtensions: [".jpg", ".jpeg", ".png", ".webp", ".gif", ".bmp", ".tga"]
property int weExtIndex: 0
source: {
var currentWallpaper = SessionData.perMonitorWallpaper ? SessionData.getMonitorWallpaper(selectedMonitorName) : SessionData.wallpaperPath
if (currentWallpaper && currentWallpaper.startsWith("we:")) {
var sceneId = currentWallpaper.substring(3)
return StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/.local/share/Steam/steamapps/workshop/content/431960/" + sceneId + "/preview" + weExtensions[weExtIndex]
}
return (currentWallpaper !== "" && !currentWallpaper.startsWith("#")) ? "file://" + currentWallpaper : ""
}
onStatusChanged: {
var currentWallpaper = SessionData.perMonitorWallpaper ? SessionData.getMonitorWallpaper(selectedMonitorName) : SessionData.wallpaperPath
if (currentWallpaper && currentWallpaper.startsWith("we:") && status === Image.Error) {
if (weExtIndex < weExtensions.length - 1) {
weExtIndex++
source = StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/.local/share/Steam/steamapps/workshop/content/431960/" + currentWallpaper.substring(3) + "/preview" + weExtensions[weExtIndex]
} else {
visible = false
}
}
}
fillMode: Image.PreserveAspectCrop
visible: {
var currentWallpaper = SessionData.perMonitorWallpaper ? SessionData.getMonitorWallpaper(selectedMonitorName) : SessionData.wallpaperPath

View File

@@ -104,11 +104,6 @@ Variants {
}
}
WallpaperEngineProc {
id: weProc
monitor: modelData.name
}
Component.onCompleted: {
if (source) {
const formattedSource = source.startsWith("file://") ? source : "file://" + source
@@ -117,30 +112,19 @@ Variants {
isInitialized = true
}
Component.onDestruction: {
weProc.stop()
}
onSourceChanged: {
const isWE = source.startsWith("we:")
const isColor = source.startsWith("#")
if (isWE) {
if (!source) {
setWallpaperImmediate("")
} else if (isColor) {
setWallpaperImmediate("")
weProc.start(source.substring(3))
} else {
weProc.stop()
if (!source) {
setWallpaperImmediate("")
} else if (isColor) {
setWallpaperImmediate("")
if (!isInitialized || !currentWallpaper.source) {
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source)
isInitialized = true
} else {
if (!isInitialized || !currentWallpaper.source) {
setWallpaperImmediate(source.startsWith("file://") ? source : "file://" + source)
isInitialized = true
} else {
changeWallpaper(source.startsWith("file://") ? source : "file://" + source)
}
changeWallpaper(source.startsWith("file://") ? source : "file://" + source)
}
}
}

View File

@@ -1,63 +0,0 @@
import QtCore
import QtQuick
import Quickshell.Io
import Quickshell
import qs.Common
Item {
id: root
property string monitor: ""
property string sceneId: ""
property string pendingSceneId: ""
Process {
id: weProcess
running: false
command: []
}
Process {
id: killer
running: false
command: []
onExited: (code) => {
if (pendingSceneId !== "") {
const cacheHome = StandardPaths.writableLocation(StandardPaths.GenericCacheLocation).toString()
const baseDir = Paths.strip(cacheHome)
const outDir = baseDir + "/DankMaterialShell/we_screenshots"
const outPath = outDir + "/" + pendingSceneId + ".jpg"
Quickshell.execDetached(["mkdir", "-p", outDir])
weProcess.command = [
"linux-wallpaperengine",
"--screen-root", monitor,
"--screenshot", outPath,
"--bg", pendingSceneId,
"--silent"
]
weProcess.running = true
sceneId = pendingSceneId
pendingSceneId = ""
}
}
}
function start(newSceneId) {
if (sceneId === newSceneId && weProcess.running) {
return
}
pendingSceneId = newSceneId
stop()
}
function stop() {
if (weProcess.running) {
weProcess.running = false
}
killer.command = [
"pkill", "-f",
"linux-wallpaperengine --screen-root " + monitor
]
killer.running = true
}
}