quickshell: remove Archie; DIAGNOSTIC shrink bar surface to the bar column
Archie goes for good — he'd have had to move to the background layer with the frame band, and that isn't where he belongs. History has him. The implicitWidth change is a diagnostic, not a design: it clips the frame, panels, toast and launcher, which all draw into this one screen-sized surface. Every cost measured today (blur 84->62, SDF 27->17) scales with that area, so this tests whether shrinking it is worth a real refactor before committing hours to one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
2450814b36
commit
978a198b43
1 changed files with 7 additions and 395 deletions
|
|
@ -478,7 +478,6 @@ in
|
|||
Bar 1.0 Bar.qml
|
||||
Lock 1.0 Lock.qml
|
||||
Cheatsheet 1.0 Cheatsheet.qml
|
||||
Archie 1.0 Archie.qml
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -1103,390 +1102,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
"quickshell/Archie.qml" = {
|
||||
onChange = qsRestart;
|
||||
text = ''
|
||||
import QtQuick
|
||||
|
||||
// Archie — a black and tan dachshund with a red collar, living
|
||||
// along the bottom of the screen. He trots about, wags, naps in
|
||||
// his bed and visits his bowl.
|
||||
//
|
||||
// The art is plain text, one character per pixel, so he can be
|
||||
// redrawn by editing the picture instead of editing code. He walks
|
||||
// evenly on all fours and never limps; that was deliberate.
|
||||
Item {
|
||||
id: archie
|
||||
anchors.fill: parent
|
||||
// One dog. The bar is instantiated per monitor.
|
||||
property bool primary: true
|
||||
visible: primary
|
||||
|
||||
// 2px pixels: plenty of resolution for a proper pointed
|
||||
// dachshund head, and he still lands smaller on screen than
|
||||
// the chunkier drawing did.
|
||||
readonly property int cell: 2
|
||||
readonly property int cols: 44
|
||||
readonly property int rows: 19
|
||||
|
||||
// Not themed — he looked how he looked.
|
||||
readonly property var pal: ({
|
||||
"K": "#2b2523", // black
|
||||
"T": "#a86a30", // tan
|
||||
"R": "#b3322c", // collar, and his bowl
|
||||
"N": "#14100f", // nose and eye
|
||||
"B": "#96602f", // kibble
|
||||
"G": "#5a667a", // bed
|
||||
"D": "#3a4454" // bed cushion
|
||||
})
|
||||
|
||||
// Trotting: front leg forward, hind leg back, tail up. Paws
|
||||
// point the way he is going — drawn trailing behind the leg
|
||||
// they read as feet on backwards, which is exactly how the
|
||||
// first pass looked.
|
||||
readonly property var walkA: [
|
||||
"...............................KKKKKKKK.....",
|
||||
"KK............................KKKKKKKKKK....",
|
||||
"KKKK..........................KKKKKKKKKKK...",
|
||||
".KKKK.........................KKKKK.KKKKK...",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKK..TTKKKKK.",
|
||||
".KKKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTTTTTT.",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTTTTT..",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTT.....",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTKKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTTKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKTTTT.............",
|
||||
".....KKKKKKKKKKKKKKKKKKKKKTTTT..............",
|
||||
"....TTKKKKKKKKKKKKKKKKKKKTTTT...............",
|
||||
".....TTTTT..............TTTT................",
|
||||
"......TTTT..............TTT.................",
|
||||
".....TTT................TTT.................",
|
||||
".....TTT................TTT.................",
|
||||
".....TTT................TTT.................",
|
||||
".....TTTTT..............TTTTT..............."
|
||||
]
|
||||
// Legs gathered under him, tail level.
|
||||
readonly property var walkB: [
|
||||
"...............................KKKKKKKK.....",
|
||||
"..............................KKKKKKKKKK....",
|
||||
"KKKK..........................KKKKKKKKKKK...",
|
||||
"KKKK..........................KKKKK.KKKKK...",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKK..TTKKKKK.",
|
||||
".KKKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTTTTTT.",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTTTTT..",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTT.....",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTKKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTTKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKTTTT.............",
|
||||
".....KKKKKKKKKKKKKKKKKKKKKTTTT..............",
|
||||
"....TTKKKKKKKKKKKKKKKKKKKTTTT...............",
|
||||
"........TTTTT........TTTT...................",
|
||||
".........TTTT........TTT....................",
|
||||
"........TTT..........TTT....................",
|
||||
"........TTT..........TTT....................",
|
||||
"........TTT..........TTT....................",
|
||||
"........TTTTT........TTTTT.................."
|
||||
]
|
||||
// Standing: walkA's planted legs, walkB's tail. Flipping
|
||||
// between this and walkA is the wag.
|
||||
readonly property var wag: [
|
||||
"...............................KKKKKKKK.....",
|
||||
"..............................KKKKKKKKKK....",
|
||||
"KKKK..........................KKKKKKKKKKK...",
|
||||
"KKKK..........................KKKKK.KKKKK...",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKK..TTKKKKK.",
|
||||
".KKKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTTTTTT.",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTTTTT..",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKTTTTT.....",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTKKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTTKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKTTTT.............",
|
||||
".....KKKKKKKKKKKKKKKKKKKKKTTTT..............",
|
||||
"....TTKKKKKKKKKKKKKKKKKKKTTTT...............",
|
||||
".....TTTTT..............TTTT................",
|
||||
"......TTTT..............TTT.................",
|
||||
".....TTT................TTT.................",
|
||||
".....TTT................TTT.................",
|
||||
".....TTT................TTT.................",
|
||||
".....TTTTT..............TTTTT..............."
|
||||
]
|
||||
// Head down in the bowl.
|
||||
readonly property var eat: [
|
||||
"............................................",
|
||||
"KK..........................................",
|
||||
"KKKK........................................",
|
||||
".KKKK.......................................",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK............",
|
||||
".KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...........",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK..........",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTKKKK..........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKKTTTKKKK.........",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKTTTTKKKKKKKK.....",
|
||||
".....KKKKKKKKKKKKKKKKKKKKKTTTTKKKKKKKKKK....",
|
||||
"....TTKKKKKKKKKKKKKKKKKKKTTTT.KKKKK.KKKK....",
|
||||
".....TTTTT..............TTTT..KKKKK.TTTKK...",
|
||||
"......TTTT..............TTT...KKKKTTTTTTTTT.",
|
||||
".....TTT................TTT...KKKKKTTTTTTT..",
|
||||
".....TTT................TTT....KKKKTTTT.....",
|
||||
".....TTT................TTT.................",
|
||||
".....TTTTT..............TTTTT..............."
|
||||
]
|
||||
// Flat out in his bed, muzzle on the cushion.
|
||||
readonly property var sleepArt: [
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"..............................KKKKKKKKK.....",
|
||||
".............................KKKKKKKKKKKK...",
|
||||
"KKKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKK.KKKKK...",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKTTTTTKKK..",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKTTTTTTTTT.",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKTTTTTTT...",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKRRTTTT...........",
|
||||
"....KKKKKKKKKKKKKKKKKKKKKKRRTTTT............",
|
||||
".....TTTTTTTTKKKKKKKKKKKKTTTT...............",
|
||||
"......TTTTTT..........TTTTTT................"
|
||||
]
|
||||
// Mid-breath: the same pose with his ribcage lifted one cell,
|
||||
// just behind the collar where a dog's chest actually is. His
|
||||
// belly stays put — that side is against the cushion.
|
||||
readonly property var sleepIn: [
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"............................................",
|
||||
"..............................KKKKKKKKK.....",
|
||||
"................KKKKKKKKKK...KKKKKKKKKKKK...",
|
||||
"KKKKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKK.KKKKK...",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKTTTTTKKK..",
|
||||
"..KKKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKTTTTTTTTT.",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKRRKKKKKTTTTTTT...",
|
||||
"...KKKKKKKKKKKKKKKKKKKKKKKKRRTTTT...........",
|
||||
"....KKKKKKKKKKKKKKKKKKKKKKRRTTTT............",
|
||||
".....TTTTTTTTKKKKKKKKKKKKTTTT...............",
|
||||
"......TTTTTT..........TTTTTT................"
|
||||
]
|
||||
readonly property var bowlArt: [
|
||||
".....BBBBBB.....",
|
||||
"...BBBBBBBBBB...",
|
||||
".BBBBBBBBBBBBBB.",
|
||||
"RRRRRRRRRRRRRRRR",
|
||||
".RRRRRRRRRRRRRR.",
|
||||
"..RRRRRRRRRRRR..",
|
||||
"...RRRRRRRRRR...",
|
||||
"....RRRRRRRR....",
|
||||
".....RRRRRR....."
|
||||
]
|
||||
readonly property var bedArt: [
|
||||
"GGGGGGG........................................GGGGGGG",
|
||||
"GGGGGGGGG....................................GGGGGGGGG",
|
||||
"GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG",
|
||||
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
|
||||
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
|
||||
"GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG",
|
||||
"..GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG.."
|
||||
]
|
||||
|
||||
property var frame: walkA
|
||||
|
||||
// ── His patch of floor ──────────────────────────────────
|
||||
readonly property real floorY: archie.height - Theme.frameWidth
|
||||
readonly property real roamL: Theme.barWidth + 12
|
||||
readonly property real roamR: Math.max(roamL,
|
||||
archie.width - Theme.frameWidth - cols * cell - 12)
|
||||
// Bed tucked into the bottom right corner, bowl beside it —
|
||||
// his corner of the room. The bowl derives from the bed so
|
||||
// they cannot drift into each other.
|
||||
readonly property real bedX: Math.max(roamL,
|
||||
archie.width - Theme.frameWidth - 54 * cell - 8)
|
||||
readonly property real bowlX: Math.max(roamL, bedX - 16 * cell - 26)
|
||||
// Stand so his muzzle lands in the bowl, not his shoulder.
|
||||
readonly property real bowlStandX: bowlX - 32 * cell
|
||||
// Lying down, centred on the cushion.
|
||||
readonly property real bedLieX: bedX + 5 * cell
|
||||
|
||||
property real px: 0
|
||||
property int facing: 1 // 1 = right, -1 = left
|
||||
property string mode: "walk"
|
||||
property real targetX: 0
|
||||
property string errand: "" // "" | "bowl" | "bed"
|
||||
property int hold: 0
|
||||
// Ticks since he last got up. Past `tired` he takes himself
|
||||
// off to bed.
|
||||
property int awake: 0
|
||||
readonly property int tired: 2700 // 90s on his feet
|
||||
// Legs swap on distance covered, not on a tick count, so the
|
||||
// gait stays in step. 3 cells is exactly how far the feet
|
||||
// move in the art.
|
||||
property real stride: 0
|
||||
property bool stepped: false
|
||||
|
||||
// ── What he does next ───────────────────────────────────
|
||||
function wander() {
|
||||
mode = "walk";
|
||||
errand = "";
|
||||
// Bed is not a random errand any more, it is what he does
|
||||
// when he has been up long enough. A dog sleeps most of
|
||||
// the day; pottering about non-stop is the odd bit.
|
||||
if (awake > tired) {
|
||||
errand = "bed";
|
||||
targetX = bedLieX;
|
||||
return;
|
||||
}
|
||||
let dBowl = Math.abs(px - bowlStandX);
|
||||
// Near enough to be worth it, and not already stood there
|
||||
// — otherwise he marches half a minute for a snack, or
|
||||
// rolls "go to the bowl" with his head already in it.
|
||||
if (Math.random() < 0.3 && dBowl > 80 && dBowl < 900) {
|
||||
errand = "bowl";
|
||||
targetX = bowlStandX;
|
||||
return;
|
||||
}
|
||||
|
||||
let dir = Math.random() < 0.5 ? -1 : 1;
|
||||
// Turn away from an end he is already near; clamping the
|
||||
// target instead just parks him against the wall.
|
||||
if (dir < 0 && px - roamL < 220) dir = 1;
|
||||
if (dir > 0 && roamR - px < 220) dir = -1;
|
||||
targetX = Math.max(roamL, Math.min(roamR,
|
||||
px + dir * (150 + Math.random() * 550)));
|
||||
}
|
||||
|
||||
function arrive() {
|
||||
if (errand === "bowl") {
|
||||
mode = "eat";
|
||||
hold = 100 + Math.random() * 80;
|
||||
facing = 1;
|
||||
} else if (errand === "bed") {
|
||||
mode = "sleep";
|
||||
hold = 9000 + Math.random() * 9000; // 5-10 minutes
|
||||
// Facing into the screen. His bed is in the right
|
||||
// corner, so unmirrored he sleeps nose-to-the-wall.
|
||||
facing = -1;
|
||||
} else {
|
||||
mode = "idle";
|
||||
hold = 150 + Math.random() * 450; // 5-20s stood about
|
||||
}
|
||||
}
|
||||
|
||||
// Placed on the first real width: anchors have not resolved at
|
||||
// Component.onCompleted, so roamR collapses to roamL and he
|
||||
// spawns pinned to the left edge.
|
||||
property bool placed: false
|
||||
onWidthChanged: {
|
||||
if (placed || width <= 0) return;
|
||||
placed = true;
|
||||
px = roamL + Math.random() * (roamR - roamL);
|
||||
wander();
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 33; running: archie.primary; repeat: true
|
||||
onTriggered: {
|
||||
archie.awake = archie.mode === "sleep" ? 0 : archie.awake + 1;
|
||||
|
||||
if (archie.mode === "walk") {
|
||||
// Arrival first: checking after the step makes him
|
||||
// stride backwards when he is already there.
|
||||
if (Math.abs(archie.targetX - archie.px) < 2.5) {
|
||||
archie.arrive();
|
||||
} else {
|
||||
let dir = archie.targetX > archie.px ? 1 : -1;
|
||||
let sp = 1.5;
|
||||
archie.facing = dir;
|
||||
archie.px += dir * sp;
|
||||
archie.stride += sp;
|
||||
if (archie.stride >= 3 * archie.cell) {
|
||||
archie.stride = 0;
|
||||
archie.stepped = !archie.stepped;
|
||||
}
|
||||
archie.frame = archie.stepped ? archie.walkB : archie.walkA;
|
||||
}
|
||||
} else {
|
||||
// Breathing: in for a third of the cycle, then
|
||||
// back down and a pause. 91 ticks is about three
|
||||
// seconds a breath, which is where a small dog
|
||||
// asleep actually sits.
|
||||
archie.frame = archie.mode === "eat" ? archie.eat
|
||||
: archie.mode === "sleep"
|
||||
? (archie.hold % 91 < 32 ? archie.sleepIn : archie.sleepArt)
|
||||
: (archie.hold % 26 < 13 ? archie.walkA : archie.wag);
|
||||
if (--archie.hold <= 0) archie.wander();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Sprite: one Rectangle per pixel, colour looked up per
|
||||
// frame, so switching frames just rebinds them.
|
||||
component Sprite: Item {
|
||||
id: sp
|
||||
property var art: []
|
||||
property int w: 0
|
||||
property int h: 0
|
||||
width: w * archie.cell
|
||||
height: h * archie.cell
|
||||
Repeater {
|
||||
// Delegates parent to the Repeater's PARENT, so `sp`
|
||||
// is the only reliable way back to the sprite here.
|
||||
model: sp.w * sp.h
|
||||
Rectangle {
|
||||
required property int index
|
||||
readonly property int col: index % sp.w
|
||||
readonly property int row: Math.floor(index / sp.w)
|
||||
readonly property string ch: sp.art[row][col]
|
||||
visible: ch !== "."
|
||||
color: archie.pal[ch] || "transparent"
|
||||
x: col * archie.cell
|
||||
y: row * archie.cell
|
||||
width: archie.cell
|
||||
height: archie.cell
|
||||
antialiasing: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bed first, so he lies in it rather than behind it.
|
||||
Sprite {
|
||||
art: archie.bedArt; w: 54; h: 7
|
||||
x: Math.round(archie.bedX / archie.cell) * archie.cell
|
||||
y: archie.floorY - height
|
||||
}
|
||||
|
||||
Sprite {
|
||||
art: archie.frame
|
||||
w: archie.cols
|
||||
h: archie.rows
|
||||
// Snap x to the pixel grid or the art shimmers as he
|
||||
// walks. y is exact: he never moves vertically, and
|
||||
// rounding sank his paws through the floor.
|
||||
x: Math.round(archie.px / archie.cell) * archie.cell
|
||||
y: archie.floorY - height
|
||||
// Mirror him when he heads back the other way.
|
||||
transform: Scale { origin.x: archie.cols * archie.cell / 2; xScale: archie.facing }
|
||||
}
|
||||
|
||||
// Bowl after him, so at dinner his nose goes behind it.
|
||||
Sprite {
|
||||
art: archie.bowlArt; w: 16; h: 9
|
||||
x: Math.round(archie.bowlX / archie.cell) * archie.cell
|
||||
y: archie.floorY - height
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
"quickshell/Commands.qml" = {
|
||||
onChange = qsRestart;
|
||||
text = ''
|
||||
|
|
@ -1868,7 +1483,13 @@ in
|
|||
bottom: true
|
||||
}
|
||||
|
||||
implicitWidth: bar.screen.width
|
||||
// DIAGNOSTIC — normally bar.screen.width, because the frame
|
||||
// band and every panel are drawn into this one surface.
|
||||
// Shrinking it to the bar column clips all of that, which
|
||||
// looks broken on purpose: the point is to measure whether
|
||||
// blur and the SDF shader are expensive because of this
|
||||
// surface's AREA. Revert this line to restore the shell.
|
||||
implicitWidth: Theme.barWidth
|
||||
exclusiveZone: Theme.barWidth
|
||||
color: "transparent"
|
||||
|
||||
|
|
@ -7544,15 +7165,6 @@ in
|
|||
}
|
||||
}
|
||||
|
||||
${lib.optionalString (!isMacbook) ''
|
||||
// Archie. One dog, primary screen only.
|
||||
//
|
||||
// Measured innocent: with blur on he looked like 22 points of
|
||||
// GPU, but that was blur recomputing behind a screen-sized
|
||||
// surface on every repaint, not his drawing. Blur off, his
|
||||
// cost is 0.
|
||||
Archie { id: archieDog; primary: bar.screen === Quickshell.screens[0] }
|
||||
''}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue