noctalia-shell/Services/PanelService.qml
LemmyCook a10d55e7f5 Bar widgets: modular loading refactoring via BarWidgetRegistry+NWidgetLoader
- Hot reload is working again.
- Should also be more memory efficient on multi monitors.
2025-08-24 23:50:09 -04:00

41 lines
869 B
QML

pragma Singleton
import Quickshell
import qs.Commons
Singleton {
id: root
// A ref. to the lockScreen, so it's accessible from anywhere
// This is not a panel...
property var lockScreen: null
// Currently opened panel
property var openedPanel: null
property var registeredPanels: ({})
// Register this panel
function registerPanel(panel) {
registeredPanels[panel.objectName] = panel
Logger.log("PanelService", "Registered:", panel.objectName)
}
// Returns a panel
function getPanel(name) {
return registeredPanels[name] || null
}
// Check if a panel exists
function hasPanel(name) {
return name in registeredPanels
}
// Helper to keep only one panel open at any time
function willOpenPanel(panel) {
if (openedPanel && openedPanel != panel) {
openedPanel.close()
}
openedPanel = panel
}
}