diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:55 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:55 +0100 |
| commit | 1ef099127f0265fd36fe4b1565ecb735b64cfca3 (patch) | |
| tree | 54b7a354467dd48d4f37814cf274241a23996fc0 /desktop/modules/fonts/test_fonts.js | |
| parent | 4a1cce078d7d27dcc9218c40a552948759d9cc5f (diff) | |
| download | quickshell-1ef099127f0265fd36fe4b1565ecb735b64cfca3.tar.gz quickshell-1ef099127f0265fd36fe4b1565ecb735b64cfca3.zip | |
feat(fonts): deck-it's text, clock sizes and clock fonts
The Fonts page gets a deck-it section: deck-it's text size (the
override.deckit deck-it already read, with no row until now), and the
dim cover's clock time and date, following it at 8 and 1.6 times unless
given their own size (up to 400px). A Families section names the
clock's fonts, deckit-clock and deckit-date, saved under "family" in
fonts.json; deck-it reads both itself. The name field updates the draft
on every keystroke, since a click on Save takes no focus and an
editingFinished would never come.
The clock font fields leave the deck-it Dashboard page, which wrote
[tablet] keys deck-it no longer reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/fonts/test_fonts.js')
| -rw-r--r-- | desktop/modules/fonts/test_fonts.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/desktop/modules/fonts/test_fonts.js b/desktop/modules/fonts/test_fonts.js index 947bd42..773da64 100644 --- a/desktop/modules/fonts/test_fonts.js +++ b/desktop/modules/fonts/test_fonts.js @@ -17,7 +17,7 @@ const fs = require("fs"); const assert = require("assert"); const src = fs.readFileSync(__dirname + "/Fonts.js", "utf8").replace(/^\.pragma library$/m, ""); -const F = new Function(src + "\nreturn { size, entryPx, withOverride, parseModel, seed, qtPt, gtkPt, kittyPt, " +const F = new Function(src + "\nreturn { DECKIT_CLOCK, size, entryPx, withOverride, withFamily, parseModel, seed, qtPt, gtkPt, kittyPt, " + "rofiEntries, hyprlockEntries, setQt, setGtk, gtkFamily, kittyFile, rofiFile, hyprlockFile };")(); const qt = '[Fonts]\nfixed="Inconsolata Nerd Font Mono,14,-1,5,400"\ngeneral="Noto Sans,14,-1,5,400,Regular"\n'; @@ -36,11 +36,16 @@ assert.strictEqual(F.setGtk(gtk2, 12), 'gtk-font-name="Noto Sans, 12"\n'); // The first save changes nothing: what differs from 16px is an override. const m = F.seed({ quickshell: 16, qt: 14 * 4 / 3, gtk: 10 * 4 / 3, kitty: 20 }); -assert.deepStrictEqual(m, { base: 16, override: { qt: 18.67, gtk: 13.33, kitty: 20 } }); +assert.deepStrictEqual(m, { base: 16, override: { qt: 18.67, gtk: 13.33, kitty: 20 }, family: {} }); assert.strictEqual(F.size(m, "quickshell"), 16); assert.strictEqual(F.size(F.withOverride(m, "qt", null), "qt"), 16); assert.strictEqual(F.parseModel("nope"), null); assert.deepStrictEqual(F.parseModel(JSON.stringify(m)), m); +// A family survives a size edit; an empty one is dropped. +const fm = F.withOverride(F.withFamily(m, "deckit-date", " Sedgwick Ave "), "qt", 20); +assert.deepStrictEqual(fm.family, { "deckit-date": "Sedgwick Ave" }); +assert.deepStrictEqual(F.withFamily(fm, "deckit-date", "").family, {}); +assert.deepStrictEqual(F.parseModel('{"base": 16}').family, {}); const rasi = ['* { font: var(kf-common-font, "Noto Sans 11"); }', 'entry { font: var(kf-launcher-entry, "Noto Sans Bold 15"); }', @@ -64,4 +69,8 @@ const sr = F.seed({ rofi: 11 * 4 / 3 }); assert.ok(F.rofiFile(sr, [{ name: "kf-a", family: "M", pt: 11 }, { name: "kf-b", family: "M", pt: 72 }]).includes('kf-b: "M 72"')); assert.strictEqual(F.kittyFile(m).split("\n")[1], "font_size 15"); +// The clock follows deck-it's text at its designed ratio. +const d = { base: 16, override: { deckit: 20 }, family: {} }; +assert.strictEqual(F.size(d, "deckit") * F.DECKIT_CLOCK[0].ratio, 160); + console.log("ok"); |
