Consolidate OMARCHY_MENU_FONT lookups onto Style.font.menuFamily

Five plugins (menu, launcher, clipboard, emojis, polkit) each looked up
OMARCHY_MENU_FONT with the same env-or-monospace fallback. Hoist the
resolution into Style so plugins read one source of truth, and so the
fallback follows the real fontconfig family Style already tracks instead
of the literal string "monospace".
This commit is contained in:
David Heinemeier Hansson
2026-05-20 20:31:04 +02:00
parent c1fca7cbe4
commit 783cccac3c
6 changed files with 15 additions and 5 deletions
+10
View File
@@ -268,9 +268,19 @@ QtObject {
return (isFinite(n) && n > 0) ? Math.round(n) : fallback
}
// The launcher, menu, polkit, emojis, and clipboard surfaces honor an
// OMARCHY_MENU_FONT override for users who want a different family on the
// summoned popups than on the bar. Resolved once at startup; an empty env
// value falls back to the shared fontconfig alias.
readonly property string menuFontFamily: {
var override = Quickshell.env("OMARCHY_MENU_FONT")
return (override && override.length > 0) ? override : fontFamily
}
readonly property QtObject font: QtObject {
readonly property string family: root.fontFamily
readonly property string resolvedFamily: root.resolvedFontFamily
readonly property string menuFamily: root.menuFontFamily
readonly property int baseSize: root.fontBaseSize
readonly property int caption: root.fontToken("caption", root.fontPx(0.833)) // 10
+1 -1
View File
@@ -27,7 +27,7 @@ Item {
property color selectedText: Color.menu.selectedText
property color selectedBorder: Color.menu.selectedBorder
readonly property int cornerRadius: Style.cornerRadius
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string fontFamily: Style.font.menuFamily
property int contentMargin: Style.spacing.panelPadding
property int headerHeight: Math.max(Style.space(34), Style.font.title + Style.spacing.controlPaddingY * 2)
property int contentSpacing: Style.spacing.md
+1 -1
View File
@@ -29,7 +29,7 @@ Item {
property color selectedText: Color.menu.selectedText
property color selectedBorder: Color.menu.selectedBorder
readonly property int cornerRadius: Style.cornerRadius
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string fontFamily: Style.font.menuFamily
property int contentMargin: Style.spacing.panelPadding
property int headerHeight: Math.max(Style.space(34), Style.font.title + Style.spacing.controlPaddingY * 2)
property int contentSpacing: Style.spacing.md
+1 -1
View File
@@ -36,7 +36,7 @@ Item {
property color selectedBackground: Color.launcher.selectedBackground
property color selectedText: Color.launcher.selectedText
property color selectedBorder: Color.launcher.selectedBorder
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string fontFamily: Style.font.menuFamily
property int cardWidth: 644
property int cardHeight: 400
+1 -1
View File
@@ -32,7 +32,7 @@ Item {
root.cancel()
}
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string fontFamily: Style.font.menuFamily
// JSONC menu definitions. The shell parses both at startup and merges
// the user file on top of the defaults, so the keybind IPC visible
// path doesn't have to shell out to bash + jq on every open.
+1 -1
View File
@@ -8,7 +8,7 @@ import qs.Commons
Item {
id: root
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string fontFamily: Style.font.menuFamily
// Bound to the central [polkit] section in shell.toml via Color.qml.
property color accent: Color.polkit.accent
property color background: Color.polkit.background