Extract panels out into their own top-level concern

This commit is contained in:
David Heinemeier Hansson
2026-05-20 13:51:39 +02:00
parent 3b9700682c
commit ea1b0e7ced
23 changed files with 154 additions and 152 deletions
+13 -11
View File
@@ -95,7 +95,7 @@ Item {
function requestPopout(owner) {
if (activePopout === owner) return
if (activePopout && "closePopout" in activePopout) activePopout.closePopout()
if (activePopout && "close" in activePopout) activePopout.close()
activePopout = owner
}
@@ -277,16 +277,16 @@ Item {
return source ? Util.fileUrl(source) : ""
}
// First-party widgets are registered with the BarWidgetRegistry at startup.
// Each entry maps a widget id to its display metadata; the QML source lives
// at widgets/<id>.qml and is loaded asynchronously via Qt.createComponent.
// First-party modules are registered with the BarWidgetRegistry at startup.
// Each entry maps a module id to its display metadata; the QML source is
// loaded asynchronously via Qt.createComponent.
readonly property var firstPartyWidgetMetadata: ({
"media": { displayName: "Media", description: "MPRIS now-playing with playback controls", category: "Media", allowMultiple: false },
"audioPanel": { displayName: "Audio", description: "Volume slider, output picker, per-app mixer", category: "Audio", allowMultiple: false },
"monitorPanel": { displayName: "Display", description: "Brightness slider and laptop display controls", category: "System", allowMultiple: false },
"networkPanel": { displayName: "Network", description: "Wi-Fi list and connection state", category: "Network", allowMultiple: false },
"powerPanel": { displayName: "Power", description: "Battery, power profile, and system stats", category: "System", allowMultiple: false },
"bluetoothPanel": { displayName: "Bluetooth", description: "Bluetooth device list with connect/disconnect", category: "Network", allowMultiple: false },
"audioPanel": { displayName: "Audio", description: "Volume slider, output picker, per-app mixer", category: "Audio", allowMultiple: false, sourceDir: "../panels", sourceName: "Audio" },
"monitorPanel": { displayName: "Display", description: "Brightness slider and laptop display controls", category: "System", allowMultiple: false, sourceDir: "../panels", sourceName: "Monitor" },
"networkPanel": { displayName: "Network", description: "Wi-Fi list and connection state", category: "Network", allowMultiple: false, sourceDir: "../panels", sourceName: "Network" },
"powerPanel": { displayName: "Power", description: "Battery, power profile, and system stats", category: "System", allowMultiple: false, sourceDir: "../panels", sourceName: "Power" },
"bluetoothPanel": { displayName: "Bluetooth", description: "Bluetooth device list with connect/disconnect", category: "Network", allowMultiple: false, sourceDir: "../panels", sourceName: "Bluetooth" },
"calendar": { displayName: "Calendar", description: "Clock with month-grid popup", category: "Time", allowMultiple: false, settingsForm: "calendarSettings" },
"notificationCenter": { displayName: "Notification center", description: "Recent notifications + DND", category: "Status", allowMultiple: false },
"systemStats": { displayName: "System stats", description: "CPU icon — hover for graphs, click to open btop", category: "System", allowMultiple: false },
@@ -316,8 +316,10 @@ Item {
}
function registerOneFirstPartyWidget(id) {
var url = Qt.resolvedUrl("widgets/" + id + ".qml")
var meta = firstPartyWidgetMetadata[id] || {}
var sourceDir = meta.sourceDir || "widgets"
var sourceName = meta.sourceName || id
var url = Qt.resolvedUrl(sourceDir + "/" + sourceName + ".qml")
var enrichedMeta = {
displayName: meta.displayName || id,
description: meta.description || "",
@@ -1285,7 +1287,7 @@ Item {
property bool expanded: false
property bool managePopupOpen: false
function closePopout() { managePopupOpen = false }
function close() { managePopupOpen = false }
// Re-resolve the tray's own entry settings whenever the bar layout reloads.
readonly property var trayEntry: {