From 783cccac3c07fa6085a8554a64c3e428df6cd9a1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 20 May 2026 20:31:04 +0200 Subject: [PATCH] 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". --- shell/Commons/Style.qml | 10 ++++++++++ shell/plugins/clipboard/Clipboard.qml | 2 +- shell/plugins/emojis/Emojis.qml | 2 +- shell/plugins/launcher/Launcher.qml | 2 +- shell/plugins/menu/Menu.qml | 2 +- shell/plugins/polkit/PolkitAgent.qml | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/shell/Commons/Style.qml b/shell/Commons/Style.qml index 95af0b71..3e18b8c2 100644 --- a/shell/Commons/Style.qml +++ b/shell/Commons/Style.qml @@ -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 diff --git a/shell/plugins/clipboard/Clipboard.qml b/shell/plugins/clipboard/Clipboard.qml index 7cdcdb9e..0ad52d66 100644 --- a/shell/plugins/clipboard/Clipboard.qml +++ b/shell/plugins/clipboard/Clipboard.qml @@ -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 diff --git a/shell/plugins/emojis/Emojis.qml b/shell/plugins/emojis/Emojis.qml index 87cf350a..24269fba 100644 --- a/shell/plugins/emojis/Emojis.qml +++ b/shell/plugins/emojis/Emojis.qml @@ -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 diff --git a/shell/plugins/launcher/Launcher.qml b/shell/plugins/launcher/Launcher.qml index 4bd1a54f..a00f9e85 100644 --- a/shell/plugins/launcher/Launcher.qml +++ b/shell/plugins/launcher/Launcher.qml @@ -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 diff --git a/shell/plugins/menu/Menu.qml b/shell/plugins/menu/Menu.qml index 63605302..5bfae265 100644 --- a/shell/plugins/menu/Menu.qml +++ b/shell/plugins/menu/Menu.qml @@ -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. diff --git a/shell/plugins/polkit/PolkitAgent.qml b/shell/plugins/polkit/PolkitAgent.qml index 94e4215c..a1a62edf 100644 --- a/shell/plugins/polkit/PolkitAgent.qml +++ b/shell/plugins/polkit/PolkitAgent.qml @@ -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