summaryrefslogtreecommitdiffstats
path: root/shared/Theme.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-29 09:55:20 +0100
committerDanilo M. <danix@danix.xyz>2026-10-29 09:55:20 +0100
commit28beb8a9600b6e74cab454401cc94c664d90bfe5 (patch)
treec91a0731af8f3204e2c2b07a96a8bbfeaae68e35 /shared/Theme.qml
parent38cda58f0969fbdda2c33a38356ab43b2869b955 (diff)
downloadquickshell-05173c6d9899416cc76175a7c39b4d7c6f935fa6.tar.gz
quickshell-05173c6d9899416cc76175a7c39b4d7c6f935fa6.zip
fonts: one font size for the desktop, with per-system overridesarchive/companion
A settings page under Appearance > Fonts holds one pixel size for the whole desktop and an override wherever a system needs its own, saved as ~/.config/keystone/fonts.json, all in px. At scale 1 the logical DPI is 96, so a point is 4/3 px, and each system is written in its own unit: Theme.fontSize reads the json itself, so every shell follows live; qt5ct/qt6ct and the GTK settings files are edited in place, size only, plus gsettings; kitty, rofi and hyprlock read generated files under ~/.config/keystone that their configs include over designed fallbacks; the groupbar is a keystone.lua line. rofi and hyprlock are sections of designed sizes that scale together from their body text, the smallest entry, each keeping its ratio unless given its own size. The design is read from the fallbacks themselves, var(kf-..., "Family N") in the rofi files and $kf_... = N in hyprlock.conf, so a new entry appears on the page with no list to keep. With no fonts.json the page starts from what the files say, base 16 and an override per system at its current size, so the first save changes nothing; seeded to 0.01px, since 0.1 scaled rofi's 72pt glyph to 72.2. Each stepper shows px then pt in fixed columns, the system's own unit highlighted. Check: node desktop/modules/fonts/test_fonts.js Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'shared/Theme.qml')
-rw-r--r--shared/Theme.qml19
1 files changed, 18 insertions, 1 deletions
diff --git a/shared/Theme.qml b/shared/Theme.qml
index e7f927e..ee432bd 100644
--- a/shared/Theme.qml
+++ b/shared/Theme.qml
@@ -42,7 +42,10 @@ Singleton {
property color mauve: "#c6a0f6"
readonly property string fontFamily: "Noto Sans"
- readonly property int fontSize: 16
+ // The base text size, in px: every size in the shells is this plus or
+ // minus an offset. From the fonts page's fonts.json (Appearance > Fonts),
+ // Quickshell's own override or the desktop-wide base; 16 until then.
+ property int fontSize: 16
// Glyphs are Nerd Font private-use codepoints. They render with this
// family, not fontFamily: fontconfig otherwise falls back per codepoint
@@ -81,4 +84,18 @@ Singleton {
root.mauve = pick("mauve") ?? root.mauve;
}
}
+
+ FileView {
+ path: `${Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config"}/keystone/fonts.json`
+ watchChanges: true
+ printErrors: false
+ onFileChanged: reload()
+ onLoaded: {
+ try {
+ const j = JSON.parse(text());
+ const px = j.override?.quickshell ?? j.base;
+ if (typeof px === "number" && px >= 8 && px <= 40) root.fontSize = Math.round(px);
+ } catch (e) {}
+ }
+ }
}