Settings → Notch switches it on. The bar becomes left and right islands with a notch at the top centre. Super+C, Super+X and a click on the notch open a three-column panel: dashboard pages on the left (Media, Performance, Calendar; the wheel switches them), the Control Center tiles and weather in the middle, and notifications on the right. The Performance card opens the full "Your computer" view. The launcher drops out of the notch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
170 lines
6.4 KiB
QML
170 lines
6.4 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import "../components"
|
|
import "../services"
|
|
import "../core"
|
|
import "../theme"
|
|
|
|
// Notification banners in a glass drawer that drops out of the bar, styled
|
|
// like the OSD. Banners stack newest first; hovering pauses their timers,
|
|
// swiping or right-clicking hides one into the Control Center.
|
|
// qmllint disable uncreatable-type
|
|
PanelWindow {
|
|
id: root
|
|
readonly property var options: NotificationService.options
|
|
readonly property var items: NotificationService.popups
|
|
property var targetScreen: null
|
|
screen: ScreenService.current(targetScreen)
|
|
readonly property int screenWidth: screen ? screen.width : 1920
|
|
// The OSD capsule takes this spot while it is up; banners wait behind it.
|
|
readonly property var osd: ShellState.osdWindow
|
|
readonly property bool yielding: !!osd && osd.shown && osd.options.position === options.position
|
|
readonly property bool shown: NotificationService.active && items.length > 0 && !yielding && !ShellState.controlCenterOpen && !ShellState.notchOpen
|
|
onItemsChanged: if (items.length > 0 && !drawer.shown)
|
|
targetScreen = ScreenService.active
|
|
// Control Center lists everything; banners would cover it.
|
|
Connections {
|
|
target: ShellState
|
|
function onControlCenterOpenChanged() {
|
|
if (ShellState.controlCenterOpen)
|
|
NotificationService.clearPopups();
|
|
}
|
|
// The notch lists everything too.
|
|
function onNotchOpenChanged() {
|
|
if (ShellState.notchOpen)
|
|
NotificationService.clearPopups();
|
|
}
|
|
}
|
|
|
|
anchors {
|
|
top: true
|
|
right: root.options.position === "top-right"
|
|
}
|
|
// Margins is present at runtime but unresolved in 0.3.1 qmltypes.
|
|
// qmllint disable unqualified unresolved-type
|
|
margins {
|
|
right: BarDrawers.margin + BarDrawers.radius
|
|
}
|
|
// qmllint enable unqualified unresolved-type
|
|
implicitWidth: Math.round(drawer.width)
|
|
implicitHeight: Math.round(BarDrawers.bottom + drawer.contentHeight)
|
|
mask: Region {
|
|
item: drawer.body
|
|
}
|
|
visible: shown || drawer.shown
|
|
color: Theme.transparent
|
|
exclusionMode: ExclusionMode.Ignore
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
WlrLayershell.namespace: "glassMxrph-notifications"
|
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
|
|
|
BarDrawer {
|
|
id: drawer
|
|
objectName: "notificationSurface"
|
|
y: BarDrawers.bottom
|
|
open: root.shown
|
|
style: root.options.animation
|
|
contentWidth: 380
|
|
// Keeps the last height while the drawer closes around its final banner.
|
|
property real lastHeight: 80
|
|
readonly property real wanted: list.contentHeight + 12
|
|
onWantedChanged: if (list.count > 0)
|
|
lastHeight = wanted
|
|
contentHeight: list.count > 0 ? wanted : lastHeight
|
|
Behavior on contentHeight {
|
|
enabled: drawer.settled
|
|
NumberAnimation {
|
|
duration: Theme.duration
|
|
easing.type: Easing.OutCubic
|
|
}
|
|
}
|
|
drawerId: "notifications"
|
|
screenName: root.screen ? root.screen.name : ""
|
|
screenX: root.options.position === "top-right" ? root.screenWidth - BarDrawers.margin - BarDrawers.radius - width : (root.screenWidth - width) / 2
|
|
|
|
ListView {
|
|
id: list
|
|
objectName: "notificationPopupList"
|
|
anchors.fill: parent
|
|
anchors.margins: 6
|
|
interactive: false
|
|
spacing: 0
|
|
model: ScriptModel {
|
|
values: root.items
|
|
}
|
|
add: Transition {
|
|
NumberAnimation {
|
|
property: "opacity"
|
|
from: 0
|
|
to: 1
|
|
duration: Theme.duration
|
|
}
|
|
}
|
|
remove: Transition {
|
|
NumberAnimation {
|
|
property: "opacity"
|
|
to: 0
|
|
duration: Theme.duration / 2
|
|
}
|
|
}
|
|
// Also finishes an add interrupted by a newer banner; otherwise the
|
|
// displaced delegate keeps its partial opacity.
|
|
displaced: Transition {
|
|
NumberAnimation {
|
|
property: "y"
|
|
duration: Theme.duration
|
|
easing.type: Easing.OutCubic
|
|
}
|
|
NumberAnimation {
|
|
property: "opacity"
|
|
to: 1
|
|
duration: Theme.duration
|
|
}
|
|
}
|
|
delegate: Item {
|
|
id: banner
|
|
required property var modelData
|
|
required property int index
|
|
width: list.width
|
|
height: card.implicitHeight
|
|
Rectangle {
|
|
visible: banner.index > 0
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.margins: 12
|
|
height: 1
|
|
color: Theme.hairline
|
|
}
|
|
NotificationCard {
|
|
id: card
|
|
objectName: "notificationPopup"
|
|
width: parent.width
|
|
notification: banner.modelData
|
|
framed: false
|
|
swipeable: true
|
|
onSwiped: NotificationService.hidePopup(banner.modelData)
|
|
}
|
|
// 0 (critical) stays until dismissed. Not read from the Timer's own
|
|
// interval: that is still the 1000 ms default when running first binds.
|
|
readonly property int lifetime: NotificationService.timeoutFor(modelData)
|
|
Timer {
|
|
id: life
|
|
interval: Math.max(1, banner.lifetime)
|
|
// Restarts from the full time after a hover, like macOS banners.
|
|
running: banner.lifetime > 0 && root.shown && !drawer.hovered
|
|
onTriggered: NotificationService.hidePopup(banner.modelData)
|
|
}
|
|
Connections {
|
|
target: NotificationService
|
|
function onPopupShown(n) {
|
|
if (n === banner.modelData && banner.lifetime > 0)
|
|
life.restart();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|