diff --git a/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml b/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml index 697a1896..b2ef540b 100644 --- a/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml +++ b/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml @@ -945,22 +945,31 @@ Column { } } - Component.onCompleted: { - Qt.callLater(() => { - const pluginComponent = PluginService.pluginWidgetComponents[pluginId]; - if (pluginComponent) { - const instance = pluginComponent.createObject(null, { - "pluginId": pluginId, - "pluginService": PluginService, - "visible": false, - "width": 0, - "height": 0 - }); - if (instance) { - pluginInstance = instance; - } + function tryCreatePluginInstance() { + const pluginComponent = PluginService.pluginWidgetComponents[pluginId]; + if (!pluginComponent) + return false; + try { + const instance = pluginComponent.createObject(null, { + "pluginId": pluginId, + "pluginService": PluginService, + "visible": false, + "width": 0, + "height": 0 + }); + if (instance) { + pluginInstance = instance; + return true; } - }); + } catch (e) { + console.warn("DragDropGrid: stale plugin component for", pluginId, "- reloading"); + PluginService.reloadPlugin(pluginId); + } + return false; + } + + Component.onCompleted: { + Qt.callLater(() => tryCreatePluginInstance()); } Connections { @@ -970,6 +979,11 @@ Column { pluginInstance.loadPluginData(); } } + function onPluginLoaded(loadedPluginId) { + if (loadedPluginId !== pluginId || pluginInstance) + return; + Qt.callLater(() => tryCreatePluginInstance()); + } } Component.onDestruction: { diff --git a/quickshell/Modules/ControlCenter/Components/EditControls.qml b/quickshell/Modules/ControlCenter/Components/EditControls.qml index d7987463..69e4b62c 100644 --- a/quickshell/Modules/ControlCenter/Components/EditControls.qml +++ b/quickshell/Modules/ControlCenter/Components/EditControls.qml @@ -13,8 +13,8 @@ Row { property Item popoutContent: null signal addWidget(string widgetId) - signal resetToDefault() - signal clearAll() + signal resetToDefault + signal clearAll height: 48 spacing: Theme.spacingS @@ -28,7 +28,7 @@ Row { y: parent ? Math.round((parent.height - height) / 2) : 0 width: 400 height: 300 - modal: true + modal: false focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside @@ -133,7 +133,7 @@ Row { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - root.addWidget(modelData.id) + root.addWidget(modelData.id); } } } diff --git a/quickshell/Modules/ControlCenter/Models/WidgetModel.qml b/quickshell/Modules/ControlCenter/Models/WidgetModel.qml index 2192682b..ac616aec 100644 --- a/quickshell/Modules/ControlCenter/Models/WidgetModel.qml +++ b/quickshell/Modules/ControlCenter/Models/WidgetModel.qml @@ -216,14 +216,18 @@ QtObject { } const pluginComponent = PluginService.pluginWidgetComponents[plugin.id]; - if (!pluginComponent || typeof pluginComponent.createObject !== 'function') { + if (!pluginComponent) continue; - } - const tempInstance = pluginComponent.createObject(null); - if (!tempInstance) { + let tempInstance; + try { + tempInstance = pluginComponent.createObject(null); + } catch (e) { + PluginService.reloadPlugin(plugin.id); continue; } + if (!tempInstance) + continue; const hasCCWidget = tempInstance.ccWidgetIcon && tempInstance.ccWidgetIcon.length > 0; tempInstance.destroy();