Extract notification center bar widget

This commit is contained in:
David Heinemeier Hansson
2026-07-25 10:59:09 -07:00
parent 6cea478581
commit fc4caf3c60
7 changed files with 10 additions and 458 deletions
@@ -110,24 +110,13 @@ ShellRoot {
Item { id: host }
QtObject {
id: mockNotificationService
property bool doNotDisturb: false
property ListModel pendingModel: ListModel {}
property ListModel pastModel: ListModel {}
function setDoNotDisturb(value) { doNotDisturb = !!value }
}
QtObject {
id: mockShell
property var bar: fakeBar
property var barConfig: ({ position: "top" })
property var shellConfig: ({ version: 1, idle: {}, plugins: [], bar: { layout: { left: [], center: [], right: [] } } })
function firstPartyServiceFor(id) {
if (id === "omarchy.notifications") return mockNotificationService
return null
}
function serviceFor(id) { return firstPartyServiceFor(id) }
function firstPartyServiceFor(id) { return null }
function serviceFor(id) { return null }
function summon(id, payloadJson) { return true }
function hide(id) { return true }
function toggle(id, payloadJson) { return true }
@@ -137,24 +137,13 @@ ShellRoot {
function rescan() {}
}
QtObject {
id: mockNotificationService
property bool doNotDisturb: false
property ListModel pendingModel: ListModel {}
property ListModel pastModel: ListModel {}
function setDoNotDisturb(value) { doNotDisturb = !!value }
}
QtObject {
id: mockShell
property var bar: fakeBar
property var barConfig: ({ position: "top" })
property var shellConfig: ({ version: 1, idle: {}, plugins: [], bar: { layout: { left: [], center: [], right: [] } } })
function firstPartyServiceFor(id) {
if (id === "omarchy.notifications") return mockNotificationService
return null
}
function serviceFor(id) { return firstPartyServiceFor(id) }
function firstPartyServiceFor(id) { return null }
function serviceFor(id) { return null }
function summon(id, payloadJson) { return true }
function hide(id) { return true }
function toggle(id, payloadJson) { return true }
-5
View File
@@ -188,7 +188,6 @@ assertEqual(notifications.imageExtension('/tmp/no-extension'), 'png', 'notificat
assertEqual(notifications.imageExtension('/tmp/archive.reallylong'), 'png', 'notifications reject suspicious image extensions')
const serviceQml = fs.readFileSync(path.join(root, 'shell/plugins/notifications/Service.qml'), 'utf8')
const barWidgetQml = fs.readFileSync(path.join(root, 'shell/plugins/notifications/BarWidget.qml'), 'utf8')
assert(
/readonly property int historyReplayLimit: 5/.test(serviceQml),
'notifications service limits history replay to five rows'
@@ -197,8 +196,4 @@ assert(
/function showHistory\(\): string \{\s*return service\.showRecentHistory\(\)\s*\}/.test(serviceQml),
'notifications history IPC replays recent notifications'
)
assert(
!barWidgetQml.includes('historyOpenRequested'),
'notifications history IPC does not depend on the bar widget'
)
JS