add animations to wallpaper switch
This commit is contained in:
parent
f788756a05
commit
d4ae7be638
@ -31,8 +31,8 @@ Rectangle {
|
|||||||
Layout.leftMargin: 10
|
Layout.leftMargin: 10
|
||||||
IconImage {
|
IconImage {
|
||||||
id: icon
|
id: icon
|
||||||
source: root.activeWindow.activated ? Quickshell.iconPath(root.activeWindow.appId, "kitty") : Quickshell.iconPath("kitty")
|
source: root.activeWindow.activated ? Quickshell.iconPath(root.activeWindow.appId, "kitty") : ""
|
||||||
implicitSize: 16
|
implicitSize: root.activeWindow.activated ? 16 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CustomText {
|
CustomText {
|
||||||
|
|||||||
@ -1,32 +1,75 @@
|
|||||||
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
|
||||||
|
|
||||||
Variants {
|
WlrLayershell {
|
||||||
id: root
|
id: root
|
||||||
model: Quickshell.screens
|
layer: WlrLayer.Background
|
||||||
delegate: WlrLayershell {
|
keyboardFocus: WlrKeyboardFocus.None
|
||||||
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.Stretch
|
width: wallStack.width
|
||||||
source: Settings.config.currentWall
|
height: wallStack.height
|
||||||
}
|
asynchronous: true // ⚡ VERY IMPORTANT: Prevents lag while loading!
|
||||||
ScreenCorners {}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ CustomText {
|
|||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
font {
|
font {
|
||||||
hintingPreference: Font.PreferNoHinting
|
hintingPreference: Font.PreferNoHinting
|
||||||
family: "Material Symbols Outlined"
|
family: "Material Symbols Rounded"
|
||||||
pixelSize: iconSize
|
pixelSize: iconSize
|
||||||
weight: Font.Normal + (Font.DemiBold - Font.Normal) * truncatedFill
|
weight: Font.Normal + (Font.DemiBold - Font.Normal) * truncatedFill
|
||||||
variableAxes: {
|
variableAxes: {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import Quickshell.Io
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
property alias config: settingsAdapter
|
property alias config: settingsAdapter
|
||||||
|
property alias currentWall: settingsAdapter.currentWall
|
||||||
onConfigChanged: settingsView.writeAdapter()
|
onConfigChanged: settingsView.writeAdapter()
|
||||||
FileView {
|
FileView {
|
||||||
id: settingsView
|
id: settingsView
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user