Wallpaper: On startup set wallpaper without transition
This commit is contained in:
parent
63e90a5c17
commit
2f9eb28596
3 changed files with 28 additions and 9 deletions
|
|
@ -17,13 +17,24 @@ Variants {
|
|||
sourceComponent: PanelWindow {
|
||||
id: root
|
||||
|
||||
readonly property real transitionDuration: Settings.data.wallpaper.transitionDuration
|
||||
readonly property real transitionType: Settings.data.wallpaper.transitionType
|
||||
// Internal state management
|
||||
property bool transitioning: false
|
||||
property real fadeValue: 0.0
|
||||
property bool firstWallpaper: true
|
||||
|
||||
// External state management
|
||||
property string servicedWallpaper: WallpaperService.getWallpaper(modelData.name)
|
||||
onServicedWallpaperChanged: {
|
||||
if (servicedWallpaper && servicedWallpaper !== currentWallpaper.source) {
|
||||
if (Settings.data.wallpaper.transitionType == 'fade') {
|
||||
|
||||
// Set wallpaper immediately on startup
|
||||
if (firstWallpaper) {
|
||||
firstWallpaper = false
|
||||
setWallpaperImmediate(servicedWallpaper)
|
||||
return
|
||||
}
|
||||
|
||||
if (Settings.data.wallpaper.transitionType === 'fade') {
|
||||
setWallpaperWithTransition(servicedWallpaper)
|
||||
} else {
|
||||
setWallpaperImmediate(servicedWallpaper)
|
||||
|
|
@ -31,10 +42,6 @@ Variants {
|
|||
}
|
||||
}
|
||||
|
||||
// Internal state management
|
||||
property bool transitioning: false
|
||||
property real fadeValue: 0.0
|
||||
|
||||
color: Color.transparent
|
||||
screen: modelData
|
||||
WlrLayershell.layer: WlrLayer.Background
|
||||
|
|
@ -114,6 +121,18 @@ Variants {
|
|||
|
||||
function setWallpaperWithTransition(source) {
|
||||
if (source != currentWallpaper.source) {
|
||||
|
||||
if (transitioning) {
|
||||
// we are interupting a transition
|
||||
if (fadeValue >= 0.5) {
|
||||
|
||||
}
|
||||
currentWallpaper.source = nextWallpaper.source
|
||||
fadeAnimation.stop()
|
||||
fadeValue = 0
|
||||
transitioning = false
|
||||
}
|
||||
|
||||
nextWallpaper.source = source
|
||||
startTransition()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue