mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
WallpaperService: refactored to a simpler signal based approach.
This commit is contained in:
@@ -18,7 +18,6 @@ Variants {
|
||||
id: root
|
||||
|
||||
// Internal state management
|
||||
property bool firstWallpaper: true
|
||||
property string transitionType: "fade"
|
||||
property real transitionProgress: 0
|
||||
|
||||
@@ -37,17 +36,26 @@ Variants {
|
||||
property real stripesCount: 16
|
||||
property real stripesAngle: 0
|
||||
|
||||
// External state management
|
||||
property string servicedWallpaper: modelData ? WallpaperService.getWallpaper(modelData.name) : ""
|
||||
// Used to debounce wallpaper changes
|
||||
property string futureWallpaper: ""
|
||||
onServicedWallpaperChanged: {
|
||||
// Set wallpaper immediately on startup
|
||||
if (firstWallpaper) {
|
||||
firstWallpaper = false
|
||||
setWallpaperImmediate(servicedWallpaper)
|
||||
} else {
|
||||
futureWallpaper = servicedWallpaper
|
||||
debounceTimer.restart()
|
||||
|
||||
// On startup assign wallpaper immediately
|
||||
Component.onCompleted: {
|
||||
var path = modelData ? WallpaperService.getWallpaper(modelData.name) : ""
|
||||
setWallpaperImmediate(path)
|
||||
}
|
||||
|
||||
// External state management
|
||||
Connections {
|
||||
target: WallpaperService
|
||||
function onWallpaperChanged(screenName, path) {
|
||||
if (screenName === modelData.name) {
|
||||
|
||||
// Update wallpaper display
|
||||
// Set wallpaper immediately on startup
|
||||
futureWallpaper = path
|
||||
debounceTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,24 @@ Variants {
|
||||
|
||||
active: Settings.isLoaded && CompositorService.isNiri && modelData
|
||||
|
||||
property string wallpaper: ""
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
Component.onCompleted: {
|
||||
if (modelData) {
|
||||
Logger.log("Overview", "Loading Overview component for Niri on", modelData.name)
|
||||
}
|
||||
wallpaper = modelData ? WallpaperService.getWallpaper(modelData.name) : ""
|
||||
}
|
||||
|
||||
// External state management
|
||||
Connections {
|
||||
target: WallpaperService
|
||||
function onWallpaperChanged(screenName, path) {
|
||||
if (screenName === modelData.name) {
|
||||
wallpaper = path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
color: Color.transparent
|
||||
@@ -38,7 +51,7 @@ Variants {
|
||||
id: bgImage
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: modelData ? WallpaperService.getWallpaper(modelData.name) : ""
|
||||
source: wallpaper
|
||||
smooth: true
|
||||
mipmap: false
|
||||
cache: false
|
||||
|
||||
Reference in New Issue
Block a user