nova-shell/modules/OverviewBackdrop.qml

139 lines
3.8 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
import "." as M
PanelWindow {
id: root
required property var screen
color: "transparent"
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusiveZone: -1
WlrLayershell.namespace: "nova-overview-backdrop"
mask: Region {}
anchors.top: true
anchors.left: true
anchors.right: true
anchors.bottom: true
// Slow drifting gradient background
Rectangle {
anchors.fill: parent
property real _phase: 0
NumberAnimation on _phase {
from: 0
to: 360
duration: 30000
loops: Animation.Infinite
}
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop {
position: 0
color: Qt.rgba(M.Theme.base0C.r, M.Theme.base0C.g, M.Theme.base0C.b, 0.25)
}
GradientStop {
position: 0.5
color: Qt.rgba(M.Theme.base0E.r, M.Theme.base0E.g, M.Theme.base0E.b, 0.15)
}
GradientStop {
position: 1
color: Qt.rgba(M.Theme.base09.r, M.Theme.base09.g, M.Theme.base09.b, 0.25)
}
}
}
// Scanning line — slow horizontal sweep
Rectangle {
id: scanLine
width: 2
height: parent.height
opacity: 0.3
color: M.Theme.base0D
NumberAnimation on x {
from: 0
to: root.width
duration: 8000
loops: Animation.Infinite
easing.type: Easing.InOutSine
}
// Glow trail
Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.left
width: 60
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop {
position: 0
color: "transparent"
}
GradientStop {
position: 1
color: Qt.rgba(M.Theme.base0D.r, M.Theme.base0D.g, M.Theme.base0D.b, 0.15)
}
}
}
}
// Vertical scan line — slower
Rectangle {
id: vScanLine
width: parent.width
height: 1
opacity: 0.2
color: M.Theme.base0E
NumberAnimation on y {
from: 0
to: root.height
duration: 12000
loops: Animation.Infinite
easing.type: Easing.InOutSine
}
}
// Floating hex grid
Canvas {
anchors.fill: parent
opacity: 0.15
onPaint: {
const ctx = getContext("2d");
const w = width, h = height;
ctx.clearRect(0, 0, w, h);
ctx.strokeStyle = M.Theme.base05.toString();
ctx.lineWidth = 0.5;
const size = 40;
const dx = size * 1.5;
const dy = size * Math.sqrt(3);
for (let col = -1; col < w / dx + 1; col++) {
for (let row = -1; row < h / dy + 1; row++) {
const cx = col * dx;
const cy = row * dy + (col % 2 ? dy / 2 : 0);
ctx.beginPath();
for (let i = 0; i < 6; i++) {
const angle = Math.PI / 3 * i - Math.PI / 6;
const px = cx + size * 0.5 * Math.cos(angle);
const py = cy + size * 0.5 * Math.sin(angle);
if (i === 0)
ctx.moveTo(px, py);
else
ctx.lineTo(px, py);
}
ctx.closePath();
ctx.stroke();
}
}
}
}
}