83 lines
2.8 KiB
QML
83 lines
2.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
|
|
|
|
// Solid dark background — base01 is darker than base00
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: M.Theme.base01
|
|
}
|
|
|
|
// Hex grid with gradient-filled cells, no outlines
|
|
Canvas {
|
|
anchors.fill: parent
|
|
|
|
onPaint: {
|
|
const ctx = getContext("2d");
|
|
const w = width, h = height;
|
|
ctx.clearRect(0, 0, w, h);
|
|
|
|
const size = 50;
|
|
const dx = size * 1.5;
|
|
const dy = size * Math.sqrt(3);
|
|
|
|
const c0 = M.Theme.base0C;
|
|
const c1 = M.Theme.base0E;
|
|
const c2 = M.Theme.base09;
|
|
|
|
for (let col = -1; col < w / dx + 2; col++) {
|
|
for (let row = -1; row < h / dy + 2; row++) {
|
|
const cx = col * dx;
|
|
const cy = row * dy + (col % 2 ? dy / 2 : 0);
|
|
|
|
// Position-based color interpolation across the screen
|
|
const fx = Math.max(0, Math.min(1, cx / w));
|
|
const fy = Math.max(0, Math.min(1, cy / h));
|
|
|
|
// Blend: left=base0C, center=base0E, right=base09, modulated by y
|
|
const t = fx;
|
|
const r = t < 0.5 ? c0.r + (c1.r - c0.r) * (t * 2) : c1.r + (c2.r - c1.r) * ((t - 0.5) * 2);
|
|
const g = t < 0.5 ? c0.g + (c1.g - c0.g) * (t * 2) : c1.g + (c2.g - c1.g) * ((t - 0.5) * 2);
|
|
const b = t < 0.5 ? c0.b + (c1.b - c0.b) * (t * 2) : c1.b + (c2.b - c1.b) * ((t - 0.5) * 2);
|
|
|
|
// Opacity varies: brighter near edges, dimmer in center
|
|
const distFromCenter = Math.sqrt(Math.pow(fx - 0.5, 2) + Math.pow(fy - 0.5, 2));
|
|
const alpha = 0.03 + distFromCenter * 0.06;
|
|
|
|
ctx.fillStyle = "rgba(" + Math.round(r * 255) + "," + Math.round(g * 255) + "," + Math.round(b * 255) + "," + alpha + ")";
|
|
|
|
ctx.beginPath();
|
|
for (let i = 0; i < 6; i++) {
|
|
const angle = Math.PI / 3 * i - Math.PI / 6;
|
|
const px = cx + size * 0.48 * Math.cos(angle);
|
|
const py = cy + size * 0.48 * Math.sin(angle);
|
|
if (i === 0)
|
|
ctx.moveTo(px, py);
|
|
else
|
|
ctx.lineTo(px, py);
|
|
}
|
|
ctx.closePath();
|
|
ctx.fill();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|