Add inner bar implementation for notifications

This commit is contained in:
2025-11-22 13:53:16 +01:00
parent 0397cadf91
commit d27f0c2486
4 changed files with 36 additions and 2 deletions

View File

@@ -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": {

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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"