From 8b0e0f6e0ea2820f7679c7ca737305d6d3807de5 Mon Sep 17 00:00:00 2001 From: DiscoNiri Date: Tue, 30 Sep 2025 18:37:47 +1000 Subject: [PATCH] Add clock font setting for customizable clock displays This commit adds a new 'Clock Font' setting that allows users to customize the font used specifically for clock displays in the bar and widgets, independent of the default UI font. Features: - New clockFont property in Settings.data.ui (defaults to 'Roboto') - Updated Bar Clock widget to use the custom font with fallback support - Added searchable font dropdown in General Settings tab - Backward compatible - uses default font if clockFont is not set - Real-time updates - changes apply immediately The font selection uses FontService.availableFonts and includes proper fallback logic that respects the existing monospaced font setting. --- Commons/Settings.qml | 1 + Modules/Bar/Widgets/Clock.qml | 4 ++-- Modules/Settings/Tabs/GeneralTab.qml | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 8fd245c7..12138b8c 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -272,6 +272,7 @@ Singleton { property JsonObject ui: JsonObject { property string fontDefault: "Roboto" property string fontFixed: "DejaVu Sans Mono" + property string clockFont: "Roboto" property real fontDefaultScale: 1.0 property real fontFixedScale: 1.0 property list monitorsScaling: [] diff --git a/Modules/Bar/Widgets/Clock.qml b/Modules/Bar/Widgets/Clock.qml index 810d2b9f..fbffbb29 100644 --- a/Modules/Bar/Widgets/Clock.qml +++ b/Modules/Bar/Widgets/Clock.qml @@ -65,7 +65,7 @@ Rectangle { NText { visible: text !== "" text: modelData - family: useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault + family: Settings.data.ui.clockFont || (useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault) pointSize: { if (repeater.model.length == 1) { return Style.fontSizeS * scaling @@ -95,7 +95,7 @@ Rectangle { delegate: NText { visible: text !== "" text: modelData - family: useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault + family: Settings.data.ui.clockFont || (useMonospacedFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault) pointSize: Style.fontSizeS * scaling font.weight: Style.fontWeightBold color: usePrimaryColor ? Color.mPrimary : Color.mOnSurface diff --git a/Modules/Settings/Tabs/GeneralTab.qml b/Modules/Settings/Tabs/GeneralTab.qml index 405a5cd9..12658189 100644 --- a/Modules/Settings/Tabs/GeneralTab.qml +++ b/Modules/Settings/Tabs/GeneralTab.qml @@ -237,6 +237,20 @@ ColumnLayout { } } + NSearchableComboBox { + label: "Clock Font" + description: "Font used specifically for clock displays in the bar and widgets." + model: FontService.availableFonts + currentKey: Settings.data.ui.clockFont + placeholder: "Select clock font..." + searchPlaceholder: "Search fonts..." + popupHeight: 420 * scaling + minimumWidth: 300 * scaling + onSelected: function (key) { + Settings.data.ui.clockFont = key + } + } + ColumnLayout { NLabel { label: I18n.tr("settings.general.fonts.default.scale.label")