From bb025cffec630691ab71d28ef78084b6bca93ba4 Mon Sep 17 00:00:00 2001 From: notiant <238434866+notiant@users.noreply.github.com> Date: Thu, 15 Jan 2026 19:40:58 +0100 Subject: [PATCH] add option to hide notification widget when 0 notifications --- Assets/Translations/de.json | 6 ++++-- Assets/Translations/en.json | 6 ++++-- Assets/Translations/es.json | 8 +++++--- Assets/Translations/fr.json | 8 +++++--- Assets/Translations/hu.json | 6 ++++-- Assets/Translations/ja.json | 6 ++++-- Assets/Translations/ku.json | 6 ++++-- Assets/Translations/nl.json | 6 ++++-- Assets/Translations/pl.json | 6 ++++-- Assets/Translations/pt.json | 6 ++++-- Assets/Translations/ru.json | 6 ++++-- Assets/Translations/tr.json | 6 ++++-- Assets/Translations/uk-UA.json | 6 ++++-- Assets/Translations/zh-CN.json | 6 ++++-- Assets/Translations/zh-TW.json | 6 ++++-- Assets/settings-widgets-default.json | 3 ++- Modules/Bar/Widgets/NotificationHistory.qml | 7 ++++--- .../WidgetSettings/NotificationHistorySettings.qml | 12 +++++++++++- Services/UI/BarWidgetRegistry.qml | 3 ++- 19 files changed, 81 insertions(+), 38 deletions(-) diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 3dc8c20d1..cb7be7987 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Visualizer-Typ" }, "notification-history": { - "hide-widget-when-zero-description": "Benachrichtigungssymbol ausblenden, wenn keine ungelesenen Benachrichtigungen vorhanden sind.", - "hide-widget-when-zero-label": "Symbol ausblenden, wenn null", + "hide-widget-when-zero-description": "Benachrichtigungssymbol ausblenden, wenn keine Benachrichtigungen vorhanden sind.", + "hide-widget-when-zero-label": "Symbol bei keinen Benachrichtigungen ausblenden", + "hide-widget-when-zero-unread-description": "Benachrichtigungssymbol ausblenden, wenn keine ungelesenen Benachrichtigungen vorhanden sind.", + "hide-widget-when-zero-unread-label": "Symbol bei keinen ungelesenen Benachrichtigungen ausblenden", "show-unread-badge-description": "Badge mit der Anzahl ungelesener Benachrichtigungen anzeigen.", "show-unread-badge-label": "Badge für ungelesene Nachrichten anzeigen" }, diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 63b5ece36..035ec1b5b 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Visualizer type" }, "notification-history": { - "hide-widget-when-zero-description": "Hide the notification icon when there are no unread notifications.", - "hide-widget-when-zero-label": "Hide icon when zero", + "hide-widget-when-zero-description": "Hide the notification icon when there are no notifications.", + "hide-widget-when-zero-label": "Hide icon when no notifications", + "hide-widget-when-zero-unread-description": "Hide the notification icon when there are no unread notifications.", + "hide-widget-when-zero-unread-label": "Hide icon when no unread notifications", "show-unread-badge-description": "Display a badge showing the number of unread notifications.", "show-unread-badge-label": "Show unread badge" }, diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 87494ee9b..938b1f151 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Tipo de visualizador" }, "notification-history": { - "hide-widget-when-zero-description": "Ocultar el icono de notificaciones cuando no hay notificaciones no leídas.", - "hide-widget-when-zero-label": "Ocultar icono cuando es cero", + "hide-widget-when-zero-description": "Ocultar el icono de notificaciones cuando no haya notificaciones.", + "hide-widget-when-zero-label": "Ocultar icono sin notificaciones", + "hide-widget-when-zero-unread-description": "Ocultar el icono de notificaciones cuando no haya notificaciones sin leer.", + "hide-widget-when-zero-unread-label": "Ocultar icono sin notificaciones sin leer", "show-unread-badge-description": "Mostrar una insignia con el número de notificaciones no leídas.", "show-unread-badge-label": "Mostrar insignia de no leídos" }, @@ -474,7 +476,7 @@ "hide-modes": { "hidden": "Ocultar cuando esté vacío", "idle": "Ocultar cuando esté inactivo", - "transparent": "Transparente cuando está vacío", + "transparent": "Transparente cuando esté vacío", "visible": "Siempre visible" }, "launcher": { diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index d465e4eeb..8d6854412 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Type de visualiseur" }, "notification-history": { - "hide-widget-when-zero-description": "Masquer l'icône de notification quand il n'y a pas de notifications non lues.", - "hide-widget-when-zero-label": "Masquer l'icône quand zéro", + "hide-widget-when-zero-description": "Masquer l’icône de notification lorsqu’il n’y a aucune notification.", + "hide-widget-when-zero-label": "Masquer l’icône sans notifications", + "hide-widget-when-zero-unread-description": "Masquer l’icône de notification lorsqu’il n’y a aucune notification non lue.", + "hide-widget-when-zero-unread-label": "Masquer l’icône sans notifications non lues", "show-unread-badge-description": "Afficher un badge montrant le nombre de notifications non lues.", "show-unread-badge-label": "Afficher le badge non lu" }, @@ -474,7 +476,7 @@ "hide-modes": { "hidden": "Masquer quand vide", "idle": "Masquer quand inactif", - "transparent": "Transparent lorsqu'il est vide", + "transparent": "Transparent quand vide", "visible": "Toujours visible" }, "launcher": { diff --git a/Assets/Translations/hu.json b/Assets/Translations/hu.json index ac914c28e..34cbfa841 100644 --- a/Assets/Translations/hu.json +++ b/Assets/Translations/hu.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Megjelenítő típusa" }, "notification-history": { - "hide-widget-when-zero-description": "Rejtse el az értesítési ikont, ha nincsenek olvasatlan értesítések.", - "hide-widget-when-zero-label": "Ikon elrejtése nullánál", + "hide-widget-when-zero-description": "Az értesítési ikon elrejtése, ha nincs értesítés.", + "hide-widget-when-zero-label": "Ikon elrejtése értesítések nélkül", + "hide-widget-when-zero-unread-description": "Az értesítési ikon elrejtése, ha nincs olvasatlan értesítés.", + "hide-widget-when-zero-unread-label": "Ikon elrejtése olvasatlan nélkül", "show-unread-badge-description": "Jelenítsen meg egy jelvényt, amely mutatja az olvasatlan értesítések számát.", "show-unread-badge-label": "Olvasatlan jelvény megjelenítése" }, diff --git a/Assets/Translations/ja.json b/Assets/Translations/ja.json index 480dae029..2f90fd620 100644 --- a/Assets/Translations/ja.json +++ b/Assets/Translations/ja.json @@ -175,8 +175,10 @@ "visualizer-type-label": "ビジュアライザーの種類" }, "notification-history": { - "hide-widget-when-zero-description": "未読通知がない場合、通知アイコンを非表示にします。", - "hide-widget-when-zero-label": "ゼロのときはアイコンを隠す", + "hide-widget-when-zero-description": "通知がない場合に通知アイコンを非表示にします。", + "hide-widget-when-zero-label": "通知なしでアイコンを非表示", + "hide-widget-when-zero-unread-description": "未読の通知がない場合に通知アイコンを非表示にします。", + "hide-widget-when-zero-unread-label": "未読なしでアイコンを非表示", "show-unread-badge-description": "未読通知の数を表示するバッジを表示します。", "show-unread-badge-label": "未読バッジを表示" }, diff --git a/Assets/Translations/ku.json b/Assets/Translations/ku.json index 1efb05a2e..22f90f5a4 100644 --- a/Assets/Translations/ku.json +++ b/Assets/Translations/ku.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Cureyê dîtbarîker" }, "notification-history": { - "hide-widget-when-zero-description": "Îkona agahdarkirinê veşêre dema ku agahdarkirinên nexwendî tune bin.", - "hide-widget-when-zero-label": "Îkona veşêre dema ku sifir be", + "hide-widget-when-zero-description": "Dema ku ti agahdarî tune be, îkona agahdarîyê veşêre.", + "hide-widget-when-zero-label": "Îkonê bê agahdarî veşêre", + "hide-widget-when-zero-unread-description": "Dema ku ti agahdarîya nexwendî tune be, îkona agahdarîyê veşêre.", + "hide-widget-when-zero-unread-label": "Îkonê bê nexwendî veşêre", "show-unread-badge-description": "Nîşaneyekê nîşan bide ku hejmara agahiyên nehatine xwendin nîşan dide.", "show-unread-badge-label": "Nîşana ne xwendî nîşan bide" }, diff --git a/Assets/Translations/nl.json b/Assets/Translations/nl.json index baeb7e93c..29826d6c0 100644 --- a/Assets/Translations/nl.json +++ b/Assets/Translations/nl.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Type visualizer" }, "notification-history": { - "hide-widget-when-zero-description": "Verberg het meldingspictogram wanneer er geen ongelezen meldingen zijn.", - "hide-widget-when-zero-label": "Pictogram verbergen bij nul", + "hide-widget-when-zero-description": "Het meldingspictogram verbergen wanneer er geen meldingen zijn.", + "hide-widget-when-zero-label": "Pictogram verbergen zonder meldingen", + "hide-widget-when-zero-unread-description": "Het meldingspictogram verbergen wanneer er geen ongelezen meldingen zijn.", + "hide-widget-when-zero-unread-label": "Pictogram verbergen zonder ongelezen meldingen", "show-unread-badge-description": "Toon een badge met het aantal ongelezen meldingen.", "show-unread-badge-label": "Ongelezen-badge tonen" }, diff --git a/Assets/Translations/pl.json b/Assets/Translations/pl.json index 2b63a69b0..3f486b193 100644 --- a/Assets/Translations/pl.json +++ b/Assets/Translations/pl.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Typ wizualizatora" }, "notification-history": { - "hide-widget-when-zero-description": "Ukryj ikonę powiadomień, gdy nie ma nieprzeczytanych powiadomień.", - "hide-widget-when-zero-label": "Ukryj ikonę, gdy zero", + "hide-widget-when-zero-description": "Ukryj ikonę powiadomień, gdy nie ma żadnych powiadomień.", + "hide-widget-when-zero-label": "Ukryj ikonę bez powiadomień", + "hide-widget-when-zero-unread-description": "Ukryj ikonę powiadomień, gdy nie ma nieprzeczytanych powiadomień.", + "hide-widget-when-zero-unread-label": "Ukryj ikonę bez nieprzeczytanych", "show-unread-badge-description": "Wyświetl plakietkę z liczbą nieprzeczytanych powiadomień.", "show-unread-badge-label": "Pokaż plakietkę nieprzeczytanych" }, diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 17a28ce4e..2a25edfb1 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Tipo de visualizador" }, "notification-history": { - "hide-widget-when-zero-description": "Ocultar o ícone de notificação quando não há notificações não lidas.", - "hide-widget-when-zero-label": "Ocultar ícone quando zero", + "hide-widget-when-zero-description": "Ocultar o ícone de notificações quando não houver notificações.", + "hide-widget-when-zero-label": "Ocultar ícone sem notificações", + "hide-widget-when-zero-unread-description": "Ocultar o ícone de notificações quando não houver notificações não lidas.", + "hide-widget-when-zero-unread-label": "Ocultar ícone sem notificações não lidas", "show-unread-badge-description": "Exibir um distintivo mostrando o número de notificações não lidas.", "show-unread-badge-label": "Mostrar distintivo de não lidos" }, diff --git a/Assets/Translations/ru.json b/Assets/Translations/ru.json index 9a876e82f..d768bc1d4 100644 --- a/Assets/Translations/ru.json +++ b/Assets/Translations/ru.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Тип визуализатора" }, "notification-history": { - "hide-widget-when-zero-description": "Скрыть значок уведомлений, когда нет непрочитанных уведомлений.", - "hide-widget-when-zero-label": "Скрыть значок, если ноль", + "hide-widget-when-zero-description": "Скрывать значок уведомлений, если уведомлений нет.", + "hide-widget-when-zero-label": "Скрывать значок без уведомлений", + "hide-widget-when-zero-unread-description": "Скрывать значок уведомлений, если нет непрочитанных.", + "hide-widget-when-zero-unread-label": "Скрывать значок без непрочитанных", "show-unread-badge-description": "Отображать значок, показывающий количество непрочитанных уведомлений.", "show-unread-badge-label": "Показывать значок непрочитанных" }, diff --git a/Assets/Translations/tr.json b/Assets/Translations/tr.json index cecf29e57..ca35fa59f 100644 --- a/Assets/Translations/tr.json +++ b/Assets/Translations/tr.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Görselleştirici türü" }, "notification-history": { - "hide-widget-when-zero-description": "Okunmamış bildirim olmadığında bildirim simgesini gizle.", - "hide-widget-when-zero-label": "Sıfırken simgeyi gizle", + "hide-widget-when-zero-description": "Bildirim yokken bildirim simgesini gizle.", + "hide-widget-when-zero-label": "Bildirim yokken simgeyi gizle", + "hide-widget-when-zero-unread-description": "Okunmamış bildirim yokken bildirim simgesini gizle.", + "hide-widget-when-zero-unread-label": "Okunmamış yokken simgeyi gizle", "show-unread-badge-description": "Okunmamış bildirim sayısını gösteren bir rozet göster.", "show-unread-badge-label": "Okunmamış bildirimleri göster" }, diff --git a/Assets/Translations/uk-UA.json b/Assets/Translations/uk-UA.json index d4e8ebbb5..da6044e87 100644 --- a/Assets/Translations/uk-UA.json +++ b/Assets/Translations/uk-UA.json @@ -175,8 +175,10 @@ "visualizer-type-label": "Тип візуалізатора" }, "notification-history": { - "hide-widget-when-zero-description": "Приховувати значок сповіщень, коли немає непрочитаних сповіщень.", - "hide-widget-when-zero-label": "Приховувати значок при нулі", + "hide-widget-when-zero-description": "Приховувати значок сповіщень, якщо сповіщень немає.", + "hide-widget-when-zero-label": "Приховувати значок без сповіщень", + "hide-widget-when-zero-unread-description": "Приховувати значок сповіщень, якщо немає непрочитаних.", + "hide-widget-when-zero-unread-label": "Приховувати значок без непрочитаних", "show-unread-badge-description": "Відображати значок з кількістю непрочитаних сповіщень.", "show-unread-badge-label": "Показувати значок непрочитаних" }, diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 6171ce70c..7481a8b4a 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -175,8 +175,10 @@ "visualizer-type-label": "可视化器类型" }, "notification-history": { - "hide-widget-when-zero-description": "当没有未读通知时隐藏通知图标。", - "hide-widget-when-zero-label": "空时隐藏图标", + "hide-widget-when-zero-description": "没有通知时隐藏通知图标。", + "hide-widget-when-zero-label": "无通知时隐藏图标", + "hide-widget-when-zero-unread-description": "没有未读通知时隐藏通知图标。", + "hide-widget-when-zero-unread-label": "无未读时隐藏图标", "show-unread-badge-description": "显示一个用于展示未读通知数量的徽章。", "show-unread-badge-label": "显示未读徽章" }, diff --git a/Assets/Translations/zh-TW.json b/Assets/Translations/zh-TW.json index 0af74ba9e..60c990be5 100644 --- a/Assets/Translations/zh-TW.json +++ b/Assets/Translations/zh-TW.json @@ -159,8 +159,10 @@ "visualizer-type-label": "視覺效果樣式" }, "notification-history": { - "hide-widget-when-zero-description": "如果沒有任何未讀通知就隱藏通知圖示", - "hide-widget-when-zero-label": "零通知時隱藏圖示", + "hide-widget-when-zero-description": "沒有通知時隱藏通知圖示。", + "hide-widget-when-zero-label": "無通知時隱藏圖示", + "hide-widget-when-zero-unread-description": "沒有未讀通知時隱藏通知圖示。", + "hide-widget-when-zero-unread-label": "無未讀時隱藏圖示", "show-unread-badge-description": "顯示帶有數量的未讀標記", "show-unread-badge-label": "顯示未讀標記" }, diff --git a/Assets/settings-widgets-default.json b/Assets/settings-widgets-default.json index fb5cbe523..deab603c2 100644 --- a/Assets/settings-widgets-default.json +++ b/Assets/settings-widgets-default.json @@ -113,7 +113,8 @@ }, "NotificationHistory": { "showUnreadBadge": true, - "hideWhenZero": false + "hideWhenZero": false, + "hideWhenZeroUnread": false }, "SessionMenu": { "colorName": "error" diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index 012e6e651..6eba12142 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -32,6 +32,7 @@ NIconButton { } readonly property bool showUnreadBadge: (widgetSettings.showUnreadBadge !== undefined) ? widgetSettings.showUnreadBadge : widgetMetadata.showUnreadBadge readonly property bool hideWhenZero: (widgetSettings.hideWhenZero !== undefined) ? widgetSettings.hideWhenZero : widgetMetadata.hideWhenZero + readonly property bool hideWhenZeroUnread: (widgetSettings.hideWhenZeroUnread !== undefined) ? widgetSettings.hideWhenZeroUnread : widgetMetadata.hideWhenZeroUnread function computeUnreadCount() { var since = NotificationService.lastSeenTs; @@ -60,8 +61,8 @@ NIconButton { colorBorderHover: "transparent" border.color: Style.capsuleBorderColor border.width: Style.capsuleBorderWidth - visible: count > 0 || !hideWhenZero - opacity: (count > 0 || !hideWhenZero) ? 1.0 : 0.0 + visible: !((hideWhenZero && NotificationService.historyList.count === 0) || (hideWhenZeroUnread && count === 0)) + opacity: !((hideWhenZero && NotificationService.historyList.count === 0) || (hideWhenZeroUnread && count === 0)) ? 1.0 : 0.0 NPopupContextMenu { id: contextMenu @@ -131,4 +132,4 @@ NIconButton { visible: count > 0 } } -} +} \ No newline at end of file diff --git a/Modules/Panels/Settings/Bar/WidgetSettings/NotificationHistorySettings.qml b/Modules/Panels/Settings/Bar/WidgetSettings/NotificationHistorySettings.qml index 1e15bf6c2..9de7fcbc1 100644 --- a/Modules/Panels/Settings/Bar/WidgetSettings/NotificationHistorySettings.qml +++ b/Modules/Panels/Settings/Bar/WidgetSettings/NotificationHistorySettings.qml @@ -15,11 +15,13 @@ ColumnLayout { // Local state property bool valueShowUnreadBadge: widgetData.showUnreadBadge !== undefined ? widgetData.showUnreadBadge : widgetMetadata.showUnreadBadge property bool valueHideWhenZero: widgetData.hideWhenZero !== undefined ? widgetData.hideWhenZero : widgetMetadata.hideWhenZero + property bool valueHideWhenZeroUnread: widgetData.hideWhenZeroUnread !== undefined ? widgetData.hideWhenZeroUnread : widgetMetadata.hideWhenZeroUnread function saveSettings() { var settings = Object.assign({}, widgetData || {}); settings.showUnreadBadge = valueShowUnreadBadge; settings.hideWhenZero = valueHideWhenZero; + settings.hideWhenZeroUnread = valueHideWhenZeroUnread; return settings; } @@ -35,5 +37,13 @@ ColumnLayout { description: I18n.tr("bar.notification-history.hide-widget-when-zero-description") checked: valueHideWhenZero onToggled: checked => valueHideWhenZero = checked + visible: !valueHideWhenZeroUnread } -} + + NToggle { + label: I18n.tr("bar.notification-history.hide-widget-when-zero-unread-label") + description: I18n.tr("bar.notification-history.hide-widget-when-zero-unread-description") + checked: valueHideWhenZeroUnread + onToggled: checked => valueHideWhenZeroUnread = checked + } +} \ No newline at end of file diff --git a/Services/UI/BarWidgetRegistry.qml b/Services/UI/BarWidgetRegistry.qml index 56c65e5d8..276c45b13 100644 --- a/Services/UI/BarWidgetRegistry.qml +++ b/Services/UI/BarWidgetRegistry.qml @@ -185,7 +185,8 @@ Singleton { }, "NotificationHistory": { "showUnreadBadge": true, - "hideWhenZero": false + "hideWhenZero": false, + "hideWhenZeroUnread": false }, "SessionMenu": { "colorName": "error"