From 08fd6e26d8f8bb55b83065d9f8761aacbe2cb8de Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 12 Jun 2026 03:40:33 +0800 Subject: [PATCH] feat(notifications): user-configurable font size for notification summary and body (#2461) * feat(notifications): add user-configurable font size for summary and body in notification popups * feat: add Unset for falling back to previous default values * fix: prek hook errors --------- Co-authored-by: Klesh Wong --- .gitignore | 2 ++ quickshell/Common/SettingsData.qml | 2 ++ quickshell/Common/settings/SettingsSpec.js | 2 ++ .../Notifications/Popup/NotificationPopup.qml | 5 ++-- .../Modules/Settings/NotificationsTab.qml | 28 +++++++++++++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e62cfc7c..6723df62 100644 --- a/.gitignore +++ b/.gitignore @@ -115,3 +115,5 @@ core.* .direnv/ quickshell/dms-plugins __pycache__ + +.vscode/ diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index c466ddf3..cb088ba0 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -515,6 +515,8 @@ Singleton { property bool notepadUseMonospace: true property string notepadFontFamily: "" property real notepadFontSize: 14 + property real notificationSummaryFontSize: Spec.SPEC.notificationSummaryFontSize.def + property real notificationBodyFontSize: Spec.SPEC.notificationBodyFontSize.def property bool notepadShowLineNumbers: false property real notepadTransparencyOverride: -1 property real notepadLastCustomTransparency: 0.7 diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index 3f6e03bf..40a437bc 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -260,6 +260,8 @@ var SPEC = { notepadUseMonospace: { def: true }, notepadFontFamily: { def: "" }, notepadFontSize: { def: 14 }, + notificationSummaryFontSize: { def: 0 }, + notificationBodyFontSize: { def: 0 }, notepadShowLineNumbers: { def: false }, notepadTransparencyOverride: { def: -1 }, notepadLastCustomTransparency: { def: 0.7 }, diff --git a/quickshell/Modules/Notifications/Popup/NotificationPopup.qml b/quickshell/Modules/Notifications/Popup/NotificationPopup.qml index 3b1a8e1f..8887bd50 100644 --- a/quickshell/Modules/Notifications/Popup/NotificationPopup.qml +++ b/quickshell/Modules/Notifications/Popup/NotificationPopup.qml @@ -922,10 +922,11 @@ PanelWindow { } } + StyledText { text: notificationData ? (notificationData.summary || "") : "" color: Theme.surfaceText - font.pixelSize: Theme.fontSizeMedium + font.pixelSize: SettingsData.notificationSummaryFontSize || Theme.fontSizeMedium font.weight: Font.Medium width: parent.width elide: Text.ElideRight @@ -941,7 +942,7 @@ PanelWindow { text: notificationData ? (notificationData.htmlBody || "") : "" textFormat: Text.StyledText color: Theme.surfaceVariantText - font.pixelSize: Theme.fontSizeSmall + font.pixelSize: SettingsData.notificationBodyFontSize || Theme.fontSizeSmall width: parent.width elide: descriptionExpanded ? Text.ElideNone : Text.ElideRight horizontalAlignment: Text.AlignLeft diff --git a/quickshell/Modules/Settings/NotificationsTab.qml b/quickshell/Modules/Settings/NotificationsTab.qml index 2f74a78c..40946329 100644 --- a/quickshell/Modules/Settings/NotificationsTab.qml +++ b/quickshell/Modules/Settings/NotificationsTab.qml @@ -200,12 +200,40 @@ Item { anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL + SettingsCard { width: parent.width iconName: "notifications" title: I18n.tr("Notification Popups") settingKey: "notificationPopups" + // Font size selectors for summary and body + SettingsDropdownRow { + settingKey: "notificationSummaryFontSize" + tags: ["notification", "font", "summary", "size"] + text: I18n.tr("Summary Font Size") + description: I18n.tr("Set the font size for notification summary text") + options: [I18n.tr("Unset"), "10", "12", "14", "16", "18"] + currentValue: (SettingsData.notificationSummaryFontSize || I18n.tr("Unset")).toString() + onValueChanged: value => { + SettingsData.set("notificationSummaryFontSize", Number(value === I18n.tr("Unset") ? 0 : value)); + SettingsData.sendTestNotifications(); + } + } + + SettingsDropdownRow { + settingKey: "notificationBodyFontSize" + tags: ["notification", "font", "body", "size"] + text: I18n.tr("Body Font Size") + description: I18n.tr("Set the font size for notification body text (htmlBody)") + options: [I18n.tr("Unset"), "10", "12", "14", "16", "18"] + currentValue: (SettingsData.notificationBodyFontSize || I18n.tr("Unset")).toString() + onValueChanged: value => { + SettingsData.set("notificationBodyFontSize", Number(value === I18n.tr("Unset") ? 0 : value)); + SettingsData.sendTestNotifications(); + } + } + SettingsDropdownRow { settingKey: "notificationPopupPosition" tags: ["notification", "popup", "position", "screen", "location"]