1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-13 14:36:32 -04:00

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 <kleshwong@gmail.com>
This commit is contained in:
Klesh Wong
2026-06-12 03:40:33 +08:00
committed by GitHub
parent 29e8470f2e
commit 08fd6e26d8
5 changed files with 37 additions and 2 deletions
+2
View File
@@ -115,3 +115,5 @@ core.*
.direnv/ .direnv/
quickshell/dms-plugins quickshell/dms-plugins
__pycache__ __pycache__
.vscode/
+2
View File
@@ -515,6 +515,8 @@ Singleton {
property bool notepadUseMonospace: true property bool notepadUseMonospace: true
property string notepadFontFamily: "" property string notepadFontFamily: ""
property real notepadFontSize: 14 property real notepadFontSize: 14
property real notificationSummaryFontSize: Spec.SPEC.notificationSummaryFontSize.def
property real notificationBodyFontSize: Spec.SPEC.notificationBodyFontSize.def
property bool notepadShowLineNumbers: false property bool notepadShowLineNumbers: false
property real notepadTransparencyOverride: -1 property real notepadTransparencyOverride: -1
property real notepadLastCustomTransparency: 0.7 property real notepadLastCustomTransparency: 0.7
@@ -260,6 +260,8 @@ var SPEC = {
notepadUseMonospace: { def: true }, notepadUseMonospace: { def: true },
notepadFontFamily: { def: "" }, notepadFontFamily: { def: "" },
notepadFontSize: { def: 14 }, notepadFontSize: { def: 14 },
notificationSummaryFontSize: { def: 0 },
notificationBodyFontSize: { def: 0 },
notepadShowLineNumbers: { def: false }, notepadShowLineNumbers: { def: false },
notepadTransparencyOverride: { def: -1 }, notepadTransparencyOverride: { def: -1 },
notepadLastCustomTransparency: { def: 0.7 }, notepadLastCustomTransparency: { def: 0.7 },
@@ -922,10 +922,11 @@ PanelWindow {
} }
} }
StyledText { StyledText {
text: notificationData ? (notificationData.summary || "") : "" text: notificationData ? (notificationData.summary || "") : ""
color: Theme.surfaceText color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium font.pixelSize: SettingsData.notificationSummaryFontSize || Theme.fontSizeMedium
font.weight: Font.Medium font.weight: Font.Medium
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -941,7 +942,7 @@ PanelWindow {
text: notificationData ? (notificationData.htmlBody || "") : "" text: notificationData ? (notificationData.htmlBody || "") : ""
textFormat: Text.StyledText textFormat: Text.StyledText
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall font.pixelSize: SettingsData.notificationBodyFontSize || Theme.fontSizeSmall
width: parent.width width: parent.width
elide: descriptionExpanded ? Text.ElideNone : Text.ElideRight elide: descriptionExpanded ? Text.ElideNone : Text.ElideRight
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
@@ -200,12 +200,40 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.spacingXL spacing: Theme.spacingXL
SettingsCard { SettingsCard {
width: parent.width width: parent.width
iconName: "notifications" iconName: "notifications"
title: I18n.tr("Notification Popups") title: I18n.tr("Notification Popups")
settingKey: "notificationPopups" 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 { SettingsDropdownRow {
settingKey: "notificationPopupPosition" settingKey: "notificationPopupPosition"
tags: ["notification", "popup", "position", "screen", "location"] tags: ["notification", "popup", "position", "screen", "location"]