2025-12-28 01:45:57 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
2025-12-22 13:55:00 +01:00
|
|
|
import QtQuick
|
2025-12-24 23:00:08 +01:00
|
|
|
import QtQuick.Controls // <--- Needed for StackView
|
2025-12-22 13:55:00 +01:00
|
|
|
import Quickshell
|
|
|
|
|
import Quickshell.Wayland
|
|
|
|
|
|
|
|
|
|
WlrLayershell {
|
|
|
|
|
id: root
|
|
|
|
|
layer: WlrLayer.Background
|
2025-12-24 23:00:08 +01:00
|
|
|
keyboardFocus: WlrKeyboardFocus.None
|
2025-12-22 13:55:00 +01:00
|
|
|
anchors {
|
|
|
|
|
top: true
|
|
|
|
|
bottom: true
|
|
|
|
|
left: true
|
|
|
|
|
right: true
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-24 23:00:08 +01:00
|
|
|
// We need to accept the screen from Variants
|
2025-12-27 20:47:50 +01:00
|
|
|
required property var modelData
|
2025-12-22 15:16:00 +01:00
|
|
|
|
2025-12-24 23:00:08 +01:00
|
|
|
// 1. The StackView manages the images
|
|
|
|
|
StackView {
|
|
|
|
|
id: wallStack
|
2025-12-26 00:37:39 +01:00
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
2025-12-24 23:00:08 +01:00
|
|
|
|
|
|
|
|
// 2. Define what a "Wallpaper" looks like
|
|
|
|
|
Component {
|
|
|
|
|
id: wallComponent
|
|
|
|
|
Image {
|
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2025-12-28 01:45:57 +01:00
|
|
|
width: wallStack.width
|
|
|
|
|
height: wallStack.height
|
2025-12-24 23:00:08 +01:00
|
|
|
asynchronous: true // ⚡ VERY IMPORTANT: Prevents lag while loading!
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 4. THE ANIMATIONS 🎬
|
|
|
|
|
// When a new wall replaces the old one:
|
|
|
|
|
|
|
|
|
|
// New One: Fades In (0 -> 1)
|
|
|
|
|
replaceEnter: Transition {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
property: "x"
|
|
|
|
|
from: wallStack.width
|
|
|
|
|
to: 0
|
|
|
|
|
duration: 800 // Slower = Smoother
|
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Old One: Fades Out (1 -> 0)
|
|
|
|
|
replaceExit: Transition {
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
property: "x"
|
|
|
|
|
from: 0
|
|
|
|
|
to: -wallStack.width
|
|
|
|
|
duration: 800
|
|
|
|
|
easing.type: Easing.OutQuad
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 5. The Trigger 🔫
|
|
|
|
|
// We listen for the singleton to change, then tell the Stack to update
|
|
|
|
|
Connections {
|
|
|
|
|
target: WallpaperStore
|
|
|
|
|
|
|
|
|
|
function onCurrentWallChanged() {
|
|
|
|
|
// "Replace the current item with a new wallComponent using the new source"
|
|
|
|
|
wallStack.replace(wallComponent, {
|
|
|
|
|
"source": WallpaperStore.currentWall
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-12-22 13:55:00 +01:00
|
|
|
}
|
|
|
|
|
}
|