core/reloader: trigger onPostReload if launched post-reload

This is similar to the check in Reloadable, and fixes a number of hard
to debug issues with Process, IpcHandler, NotificationServer, and
GlobalShortcut not working depending on where you put them in a QML file.
This commit is contained in:
outfoxxed 2025-07-04 15:58:41 -07:00
parent 0e6518a706
commit 9708d8212a
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
8 changed files with 36 additions and 38 deletions

View file

@ -15,10 +15,11 @@
#include "../core/generation.hpp"
#include "../core/qmlglobal.hpp"
#include "../core/reload.hpp"
#include "datastream.hpp"
#include "processcore.hpp"
Process::Process(QObject* parent): QObject(parent) {
Process::Process(QObject* parent): PostReloadHook(parent) {
QObject::connect(
QuickshellSettings::instance(),
&QuickshellSettings::workingDirectoryChanged,
@ -37,10 +38,7 @@ Process::~Process() {
}
}
void Process::onPostReload() {
this->postReload = true;
this->startProcessIfReady();
}
void Process::onPostReload() { this->startProcessIfReady(); }
bool Process::isRunning() const { return this->process != nullptr; }
@ -180,9 +178,10 @@ void Process::setStdinEnabled(bool enabled) {
}
void Process::startProcessIfReady() {
if (this->process != nullptr || !this->postReload || !this->targetRunning
if (this->process != nullptr || !this->isPostReload || !this->targetRunning
|| this->mCommand.isEmpty())
return;
this->targetRunning = false;
auto& cmd = this->mCommand.first();