2026-01-18 15:54:25 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
2026-01-15 15:14:29 +01:00
|
|
|
import QtQuick
|
2026-02-12 00:11:26 +01:00
|
|
|
import QtQuick.Controls // <--- Needed for StackView
|
2026-01-15 15:14:29 +01:00
|
|
|
import Quickshell.Wayland
|
2026-01-19 12:45:35 +01:00
|
|
|
import qs.settings
|
2026-01-15 15:14:29 +01:00
|
|
|
|
2026-02-12 00:11:26 +01:00
|
|
|
WlrLayershell {
|
2026-01-15 15:14:29 +01:00
|
|
|
id: root
|
2026-02-12 00:11:26 +01:00
|
|
|
layer: WlrLayer.Background
|
|
|
|
|
keyboardFocus: WlrKeyboardFocus.None
|
|
|
|
|
anchors {
|
|
|
|
|
top: true
|
|
|
|
|
bottom: true
|
|
|
|
|
left: true
|
|
|
|
|
right: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We need to accept the screen from Variants
|
|
|
|
|
required property var modelData
|
|
|
|
|
|
|
|
|
|
// 1. The StackView manages the images
|
|
|
|
|
StackView {
|
|
|
|
|
id: wallStack
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
|
|
// 2. Define what a "Wallpaper" looks like
|
|
|
|
|
Component {
|
|
|
|
|
id: wallComponent
|
|
|
|
|
Image {
|
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
|
width: wallStack.width
|
|
|
|
|
height: wallStack.height
|
|
|
|
|
asynchronous: true // ⚡ VERY IMPORTANT: Prevents lag while loading!
|
|
|
|
|
}
|
2026-01-15 15:14:29 +01:00
|
|
|
}
|
2026-01-18 15:54:25 +01:00
|
|
|
|
2026-02-12 00:11:26 +01:00
|
|
|
// 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: Settings
|
|
|
|
|
|
|
|
|
|
function onCurrentWallChanged() {
|
|
|
|
|
wallStack.replace(wallComponent, {
|
|
|
|
|
"source": Settings.currentWall
|
|
|
|
|
});
|
2026-01-15 15:14:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|