added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,50 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import "services"
|
||||
|
||||
PanelWindow {
|
||||
id: wallpaper
|
||||
required property var output
|
||||
readonly property string requested: output ? Wallpapers.sourceFor(output.name) : ""
|
||||
property string committed: ""
|
||||
readonly property size decodeSize: Qt.size(Math.min(4096, (output?.width || 1) * (output?.devicePixelRatio || 1)), Math.min(4096, (output?.height || 1) * (output?.devicePixelRatio || 1)))
|
||||
screen: output
|
||||
anchors { top: true; bottom: true; left: true; right: true }
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.layer: WlrLayer.Background
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
WlrLayershell.namespace: "adaptive-wallpaper"
|
||||
color: "transparent"
|
||||
visible: requested !== "" && displayed.status === Image.Ready
|
||||
function report() {
|
||||
if (!output) return;
|
||||
Wallpapers.report(output.name, requested,
|
||||
requested === "" ? "disabled" : candidate.status === Image.Error ? "error" : candidate.status === Image.Ready && displayed.status === Image.Ready ? "ready" : "loading",
|
||||
displayed.status === Image.Ready ? committed : "");
|
||||
}
|
||||
onRequestedChanged: { if (requested === "") committed = ""; report(); }
|
||||
Component.onCompleted: report()
|
||||
Component.onDestruction: if (output) Wallpapers.forget(output.name)
|
||||
// Decode before committing: a missing or unreadable new image preserves the last good image.
|
||||
Image {
|
||||
id: candidate
|
||||
source: wallpaper.requested
|
||||
asynchronous: true
|
||||
visible: false
|
||||
sourceSize: wallpaper.decodeSize
|
||||
onStatusChanged: {
|
||||
if (status === Image.Ready) wallpaper.committed = wallpaper.requested;
|
||||
wallpaper.report();
|
||||
}
|
||||
}
|
||||
Image {
|
||||
id: displayed
|
||||
anchors.fill: parent
|
||||
source: wallpaper.committed
|
||||
sourceSize: wallpaper.decodeSize
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
onStatusChanged: wallpaper.report()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user