fuck transitions
This commit is contained in:
parent
d4ae7be638
commit
53ee6f4103
@ -40,7 +40,7 @@ Rectangle {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
width: !modelData.focused ? 20 : 40
|
width: !modelData.focused ? 20 : 40
|
||||||
height: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
height: isOnMon ? Settings.config.barHeight - Settings.config.barHeight / 2 : 0
|
||||||
color: modelData.focused ? Colors.primary : Colors.surfaceContainerHigh
|
color: modelData.focused ? Colors.primary : Colors.surfaceContainer
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|
||||||
|
|||||||
@ -1,75 +1,32 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls // <--- Needed for StackView
|
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import qs.settings
|
import qs.settings
|
||||||
|
|
||||||
WlrLayershell {
|
Variants {
|
||||||
id: root
|
id: root
|
||||||
layer: WlrLayer.Background
|
model: Quickshell.screens
|
||||||
keyboardFocus: WlrKeyboardFocus.None
|
delegate: WlrLayershell {
|
||||||
|
id: wpShell
|
||||||
|
aboveWindows: false
|
||||||
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
screen: modelData
|
||||||
anchors {
|
anchors {
|
||||||
|
left: true
|
||||||
top: true
|
top: true
|
||||||
bottom: true
|
bottom: true
|
||||||
left: true
|
|
||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
layer: WlrLayer.Background
|
||||||
|
|
||||||
// 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 {
|
Image {
|
||||||
|
anchors.fill: parent
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
width: wallStack.width
|
source: Settings.config.currentWall
|
||||||
height: wallStack.height
|
|
||||||
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: Settings
|
|
||||||
|
|
||||||
function onCurrentWallChanged() {
|
|
||||||
wallStack.replace(wallComponent, {
|
|
||||||
"source": Settings.currentWall
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
ScreenCorners {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user