Files
dotfiles/quickshell/components/Geom.qml
T
nvrlandClaude Opus 5.5 18091a7109 theme: YoRHa dark — NieR:Automata interface on the space-1 wallpaper
Replaces the Persona x Mocha rice. NieR's menu language is kept whole —
plain rectangles, hairline rules, letter-spaced upright capitals, a square
marker on the current row, corner ticks round panels, and selection shown
by inverting the row — but the colours come from ~/.wallpapers/space-1.jpg
rather than from the game's beige: the grey-green void as the ground, the
suit's sage grey as text, the planet's white as the one accent, and the
hull's red indicator lights as the alarm.

The Persona geometry is switched off rather than ripped out: Theme.skew
and Theme.cut are 0, so P5Panel, Skew and Geom collapse to rectangles.
Overshoot easing, italics and black weights are gone shell-wide.

New, borrowed from caelestia's screen border: bar/Frame.qml draws the bar,
the rail and a thin left/bottom band as one hull on the bottom layer, with
the desktop as a rounded opening cut out of it. Frame also owns all four
exclusive zones, so the bar and rail are placed from the screen edge.

Hyprland moves to 1px borders lit from the planet white into grey, a soft
wide shadow and gaps measured from the opening. Alacritty, fish and dunst
get matching YoRHa palettes. Neovim, GTK/Qt and btop are still Mocha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 20:10:53 +02:00

127 lines
4.1 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
// Polygon maths for panel shapes. Under the YoRHa theme nothing leans and
// nothing is chopped (Theme.skew and Theme.cut are 0), so these collapse to
// plain rectangles; they are kept so a shape can be brought back on purpose.
// Originally the Persona 5 panel language: everything leans, and corners
// get chopped rather than rounded.
Singleton {
id: root
// A right-leaning parallelogram filling w x h. `lean` is the horizontal
// offset applied to the top edge, as a fraction of height.
function parallelogram(w: real, h: real, lean: real): var {
const off = h * lean;
return [
Qt.point(off, 0),
Qt.point(w, 0),
Qt.point(w - off, h),
Qt.point(0, h)
];
}
// Same, leaning the other way.
function parallelogramL(w: real, h: real, lean: real): var {
const off = h * lean;
return [
Qt.point(0, 0),
Qt.point(w - off, 0),
Qt.point(w, h),
Qt.point(off, h)
];
}
// Vertical counterpart: the *horizontal* edges slant instead, by a fraction
// of width. A tall rail slab has to lean this way — leaning its vertical
// edges by a fraction of its height would shear it clean off the screen.
function parallelogramV(w: real, h: real, lean: real): var {
const off = w * lean;
return [
Qt.point(0, off),
Qt.point(w, 0),
Qt.point(w, h - off),
Qt.point(0, h)
];
}
function parallelogramVL(w: real, h: real, lean: real): var {
const off = w * lean;
return [
Qt.point(0, 0),
Qt.point(w, off),
Qt.point(w, h),
Qt.point(0, h - off)
];
}
function rect(w: real, h: real): var {
return [Qt.point(0, 0), Qt.point(w, 0), Qt.point(w, h), Qt.point(0, h)];
}
// Move `dist` px from `p` toward `q`.
function toward(p: point, q: point, dist: real): point {
const dx = q.x - p.x;
const dy = q.y - p.y;
const len = Math.hypot(dx, dy);
if (len < 0.0001) return p;
const t = Math.min(dist, len / 2) / len;
return Qt.point(p.x + dx * t, p.y + dy * t);
}
// Chop the listed corners of a polygon. `corners` is an array of indices;
// pass null to chop every corner.
function chamfer(pts: var, size: real, corners: var): var {
if (size <= 0) return root.closed(pts);
const n = pts.length;
const out = [];
for (let i = 0; i < n; i++) {
const p = pts[i];
if (corners !== null && corners.indexOf(i) === -1) {
out.push(p);
continue;
}
out.push(root.toward(p, pts[(i - 1 + n) % n], size));
out.push(root.toward(p, pts[(i + 1) % n], size));
}
return root.closed(out);
}
function closed(pts: var): var {
if (pts.length === 0) return pts;
const out = pts.slice();
out.push(pts[0]);
return out;
}
// Shrink a polygon toward its centroid — used for inner strokes.
function inset(pts: var, amount: real): var {
let cx = 0, cy = 0;
for (const p of pts) { cx += p.x; cy += p.y; }
cx /= pts.length; cy /= pts.length;
return pts.map(p => {
const dx = cx - p.x, dy = cy - p.y;
const len = Math.hypot(dx, dy);
if (len < 0.0001) return p;
const t = amount / len;
return Qt.point(p.x + dx * t, p.y + dy * t);
});
}
// A jagged "torn paper" edge, the Persona 5 speech-bubble signature.
// Returns a polygon `w` x `h` whose bottom edge is serrated.
function torn(w: real, h: real, teeth: int, depth: real): var {
const out = [Qt.point(0, 0), Qt.point(w, 0)];
const step = w / teeth;
for (let i = 0; i < teeth; i++) {
const x1 = w - i * step - step / 2;
const x2 = w - (i + 1) * step;
out.push(Qt.point(x1, h));
out.push(Qt.point(x2, h - depth));
}
return out;
}
}