diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 9e640a46..5fc92f1e 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -595,7 +595,8 @@ "follow_bar": "Follow bar (default)", "top_center": "Top center", "top_left": "Top left", - "top_right": "Top right" + "top_right": "Top right", + "bar": "Bar (inline)" } }, "osd": { diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index 77cef8d3..ba9de7ea 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -89,12 +89,41 @@ Item { BarPill { id: pill + property string currentNotif + Connections { + target: NotificationService.activeList + function onCountChanged() { + // keep current text a bit longer for the animation + if (NotificationService.activeList.count > 0) { + var notif = NotificationService.activeList.get(0) + var summary = notif.summary.trim() + var body = notif.body.trim() + pill.currentNotif = `${summary}: ${body}`.replace(/\n/g, " ") + } + } + } + + Component.onCompleted: { + function dismiss(notificationId) { + if (Settings.data.notifications?.location == "bar") { + NotificationService.dismissActiveNotification(notificationId) + } + } + NotificationService.animateAndRemove.connect(dismiss); + } + + screen: root.screen density: Settings.data.bar.density oppositeDirection: BarService.getPillDirection(root) icon: NotificationService.doNotDisturb ? "bell-off" : "bell" tooltipText: NotificationService.doNotDisturb ? I18n.tr("tooltips.open-notification-history-disable-dnd") : I18n.tr("tooltips.open-notification-history-enable-dnd") + text: currentNotif + forceOpen: Settings.data.notifications?.location == "bar" && NotificationService.activeList.count > 0 + // prevent open via mouse over + forceClose: NotificationService.activeList.count == 0 + onClicked: { var panel = PanelService.getPanel("notificationHistoryPanel", screen); panel?.toggle(this); diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index ca47a6e9..d3ac9672 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -22,7 +22,7 @@ Variants { property ListModel notificationModel: NotificationService.activeList // Always create window (but with 0x0 dimensions when no notifications) - active: notificationModel.count > 0 || delayTimer.running + active: (notificationModel.count > 0 || delayTimer.running) && Settings.data.notifications?.location != "bar" // Keep loader active briefly after last notification to allow animations to complete Timer { diff --git a/Modules/Panels/Settings/Tabs/NotificationsTab.qml b/Modules/Panels/Settings/Tabs/NotificationsTab.qml index fe9009f1..4af59be6 100644 --- a/Modules/Panels/Settings/Tabs/NotificationsTab.qml +++ b/Modules/Panels/Settings/Tabs/NotificationsTab.qml @@ -74,6 +74,10 @@ ColumnLayout { { "key": "bottom_right", "name": I18n.tr("options.launcher.position.bottom_right") + }, + { + "key": "bar", + "name": I18n.tr("options.launcher.position.bar") } ] currentKey: Settings.data.notifications.location || "top_right"