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 {
|
sourceComponent: PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property real transitionDuration: Settings.data.wallpaper.transitionDuration
|
// Internal state management
|
||||||
readonly property real transitionType: Settings.data.wallpaper.transitionType
|
property bool transitioning: false
|
||||||
|
property real fadeValue: 0.0
|
||||||
|
property bool firstWallpaper: true
|
||||||
|
|
||||||
|
// External state management
|
||||||
property string servicedWallpaper: WallpaperService.getWallpaper(modelData.name)
|
property string servicedWallpaper: WallpaperService.getWallpaper(modelData.name)
|
||||||
onServicedWallpaperChanged: {
|
onServicedWallpaperChanged: {
|
||||||
if (servicedWallpaper && servicedWallpaper !== currentWallpaper.source) {
|
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)
|
setWallpaperWithTransition(servicedWallpaper)
|
||||||
} else {
|
} else {
|
||||||
setWallpaperImmediate(servicedWallpaper)
|
setWallpaperImmediate(servicedWallpaper)
|
||||||
|
|
@ -31,10 +42,6 @@ Variants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal state management
|
|
||||||
property bool transitioning: false
|
|
||||||
property real fadeValue: 0.0
|
|
||||||
|
|
||||||
color: Color.transparent
|
color: Color.transparent
|
||||||
screen: modelData
|
screen: modelData
|
||||||
WlrLayershell.layer: WlrLayer.Background
|
WlrLayershell.layer: WlrLayer.Background
|
||||||
|
|
@ -114,6 +121,18 @@ Variants {
|
||||||
|
|
||||||
function setWallpaperWithTransition(source) {
|
function setWallpaperWithTransition(source) {
|
||||||
if (source != currentWallpaper.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
|
nextWallpaper.source = source
|
||||||
startTransition()
|
startTransition()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ ColumnLayout {
|
||||||
model: wallpapersList
|
model: wallpapersList
|
||||||
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
flickableDirection: Flickable.AutoFlickDirection
|
flickableDirection: Flickable.VerticalFlick
|
||||||
interactive: false
|
interactive: false
|
||||||
|
|
||||||
property int columns: 5
|
property int columns: 5
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ ColumnLayout {
|
||||||
NSlider {
|
NSlider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
from: 100
|
from: 100
|
||||||
to: 10000
|
to: 5000
|
||||||
stepSize: 100
|
stepSize: 100
|
||||||
value: Settings.data.wallpaper.transitionDuration
|
value: Settings.data.wallpaper.transitionDuration
|
||||||
onMoved: Settings.data.wallpaper.transitionDuration = value
|
onMoved: Settings.data.wallpaper.transitionDuration = value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue