mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2025-12-05 22:26:16 +00:00
Add inner bar implementation for notifications
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user