forked from quickshell/quickshell
feat: add Process.manageLifetime
This commit is contained in:
parent
4cfe6ee0a1
commit
62f99f5754
8 changed files with 90 additions and 6 deletions
|
@ -25,3 +25,9 @@ void QuickshellPlugin::initPlugins() {
|
|||
plugin->registerTypes();
|
||||
}
|
||||
}
|
||||
|
||||
void QuickshellPlugin::runOnReload() {
|
||||
for (QuickshellPlugin* plugin: plugins) {
|
||||
plugin->onReload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,11 @@ public:
|
|||
virtual bool applies() { return true; }
|
||||
virtual void init() {}
|
||||
virtual void registerTypes() {}
|
||||
virtual void onReload() {}
|
||||
|
||||
static void registerPlugin(QuickshellPlugin& plugin);
|
||||
static void initPlugins();
|
||||
static void runOnReload();
|
||||
};
|
||||
|
||||
// NOLINTBEGIN
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <qtimer.h>
|
||||
#include <qurl.h>
|
||||
|
||||
#include "plugin.hpp"
|
||||
#include "qmlglobal.hpp"
|
||||
#include "reload.hpp"
|
||||
#include "shell.hpp"
|
||||
|
@ -41,9 +42,8 @@ RootWrapper::~RootWrapper() {
|
|||
}
|
||||
|
||||
void RootWrapper::reloadGraph(bool hard) {
|
||||
QuickshellGlobal::deleteInstance();
|
||||
|
||||
if (this->root != nullptr) {
|
||||
QuickshellGlobal::deleteInstance();
|
||||
this->engine.clearComponentCache();
|
||||
}
|
||||
|
||||
|
@ -77,10 +77,14 @@ void RootWrapper::reloadGraph(bool hard) {
|
|||
oldRoot->deleteLater();
|
||||
|
||||
QTimer::singleShot(0, [this, newRoot]() {
|
||||
if (this->root == newRoot) PostReloadHook::postReloadTree(this->root);
|
||||
if (this->root == newRoot) {
|
||||
QuickshellPlugin::runOnReload();
|
||||
PostReloadHook::postReloadTree(this->root);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
PostReloadHook::postReloadTree(newRoot);
|
||||
QuickshellPlugin::runOnReload();
|
||||
}
|
||||
|
||||
this->onConfigChanged();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue