From e96163c0750a60431abb4ff2b97ea315f04d72ba Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 19 Jul 2026 21:14:13 -0700 Subject: [PATCH] Give glyph notifications with bodies the large icon slot Co-Authored-By: Claude Fable 5 --- shell/plugins/notifications/NotificationLogic.js | 4 ++-- shell/plugins/notifications/components/NotificationCard.qml | 6 +++--- test/shell.d/notifications-test.sh | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/shell/plugins/notifications/NotificationLogic.js b/shell/plugins/notifications/NotificationLogic.js index ba482191..6f764036 100644 --- a/shell/plugins/notifications/NotificationLogic.js +++ b/shell/plugins/notifications/NotificationLogic.js @@ -53,8 +53,8 @@ function glyphFromHints(hints) { return "" } -function shouldRenderCompactGlyph(glyph, iconSource) { - return String(glyph || "").length > 0 && String(iconSource || "").length === 0 +function shouldRenderCompactGlyph(glyph, iconSource, singleLineToast) { + return String(glyph || "").length > 0 && String(iconSource || "").length === 0 && !!singleLineToast } function snapshotOf(notification, timestamp) { diff --git a/shell/plugins/notifications/components/NotificationCard.qml b/shell/plugins/notifications/components/NotificationCard.qml index def0b036..f76590f1 100644 --- a/shell/plugins/notifications/components/NotificationCard.qml +++ b/shell/plugins/notifications/components/NotificationCard.qml @@ -38,7 +38,7 @@ BorderSurface { // The `check` flag avoids Qt's missing-texture placeholder for unknown names. readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) readonly property bool hasGlyph: glyph.length > 0 - readonly property bool compactGlyph: NotificationLogic.shouldRenderCompactGlyph(glyph, smallIconSource) + readonly property bool compactGlyph: NotificationLogic.shouldRenderCompactGlyph(glyph, smallIconSource, singleLineToast) readonly property bool hasSmallIcon: smallIconSource.length > 0 readonly property bool summaryStartsWithGlyph: NotificationLogic.summaryStartsWithGlyph(summary) readonly property bool singleLineToast: sanitizedBody.length === 0 @@ -109,7 +109,7 @@ BorderSurface { // Hide the slot when the icon failed to resolve (themed-icon name // not in the user's icon theme) AND we don't have a glyph fallback // — prevents rendering Qt's pink broken-image placeholder. - visible: !root.collapseRedundantIcon && !root.compactGlyph && root.hasSmallIcon && (root.hasGlyph || smallIconImage.status !== Image.Error) + visible: !root.collapseRedundantIcon && !root.compactGlyph && (root.hasSmallIcon || root.hasGlyph) && (root.hasGlyph || smallIconImage.status !== Image.Error) Image { id: smallIconImage @@ -131,7 +131,7 @@ BorderSurface { text: root.glyph color: Color.notifications.text font.family: root.fontFamily - font.pixelSize: Style.font.iconLarge + font.pixelSize: Style.font.displayLarge } } diff --git a/test/shell.d/notifications-test.sh b/test/shell.d/notifications-test.sh index b8b7ccee..6f0a852a 100644 --- a/test/shell.d/notifications-test.sh +++ b/test/shell.d/notifications-test.sh @@ -38,8 +38,9 @@ assertEqual( assert(notifications.summaryStartsWithGlyph('󰂚 Silenced'), 'notifications detect glyph-prefixed summaries') assert(!notifications.summaryStartsWithGlyph('Normal summary'), 'notifications ignore normal summaries as glyph-prefixed') -assert(notifications.shouldRenderCompactGlyph('K', ''), 'notifications render glyph-only hints compactly') -assert(!notifications.shouldRenderCompactGlyph('K', 'file:///tmp/image.png'), 'notifications keep image-backed glyph hints in the icon slot') +assert(notifications.shouldRenderCompactGlyph('K', '', true), 'notifications render glyph-only single-line toasts compactly') +assert(!notifications.shouldRenderCompactGlyph('K', '', false), 'notifications give glyph hints with bodies the large icon slot') +assert(!notifications.shouldRenderCompactGlyph('K', 'file:///tmp/image.png', true), 'notifications keep image-backed glyph hints in the icon slot') assert(notifications.shouldBypassDnd({ appName: 'omarchy-action', urgency: 1 }, 2), 'omarchy action toasts bypass DND') assert(notifications.shouldBypassDnd({ appName: 'notify-send', urgency: 2 }, 2), 'critical notify-send bypasses DND')