mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2025-12-06 06:36:15 +00:00
Add inner bar implementation for notifications
This commit is contained in:
@@ -595,7 +595,8 @@
|
|||||||
"follow_bar": "Follow bar (default)",
|
"follow_bar": "Follow bar (default)",
|
||||||
"top_center": "Top center",
|
"top_center": "Top center",
|
||||||
"top_left": "Top left",
|
"top_left": "Top left",
|
||||||
"top_right": "Top right"
|
"top_right": "Top right",
|
||||||
|
"bar": "Bar (inline)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"osd": {
|
"osd": {
|
||||||
|
|||||||
@@ -89,12 +89,41 @@ Item {
|
|||||||
BarPill {
|
BarPill {
|
||||||
id: pill
|
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
|
screen: root.screen
|
||||||
density: Settings.data.bar.density
|
density: Settings.data.bar.density
|
||||||
oppositeDirection: BarService.getPillDirection(root)
|
oppositeDirection: BarService.getPillDirection(root)
|
||||||
icon: NotificationService.doNotDisturb ? "bell-off" : "bell"
|
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")
|
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: {
|
onClicked: {
|
||||||
var panel = PanelService.getPanel("notificationHistoryPanel", screen);
|
var panel = PanelService.getPanel("notificationHistoryPanel", screen);
|
||||||
panel?.toggle(this);
|
panel?.toggle(this);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Variants {
|
|||||||
property ListModel notificationModel: NotificationService.activeList
|
property ListModel notificationModel: NotificationService.activeList
|
||||||
|
|
||||||
// Always create window (but with 0x0 dimensions when no notifications)
|
// 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
|
// Keep loader active briefly after last notification to allow animations to complete
|
||||||
Timer {
|
Timer {
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ ColumnLayout {
|
|||||||
{
|
{
|
||||||
"key": "bottom_right",
|
"key": "bottom_right",
|
||||||
"name": I18n.tr("options.launcher.position.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"
|
currentKey: Settings.data.notifications.location || "top_right"
|
||||||
|
|||||||
Reference in New Issue
Block a user