mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
core: hash scanned files and don't trigger a reload if matching
Nix builds often trip QFileSystemWatcher, causing random reloads.
This commit is contained in:
parent
bd62179277
commit
9a9c605250
4 changed files with 48 additions and 11 deletions
|
|
@ -209,6 +209,8 @@ bool EngineGeneration::setExtraWatchedFiles(const QVector<QString>& files) {
|
|||
for (const auto& file: files) {
|
||||
if (!this->scanner.scannedFiles.contains(file)) {
|
||||
this->extraWatchedFiles.append(file);
|
||||
QByteArray data;
|
||||
this->scanner.readAndHashFile(file, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,6 +231,11 @@ void EngineGeneration::onFileChanged(const QString& name) {
|
|||
auto fileInfo = QFileInfo(name);
|
||||
if (fileInfo.isFile() && fileInfo.size() == 0) return;
|
||||
|
||||
if (!this->scanner.hasFileContentChanged(name)) {
|
||||
qCDebug(logQmlScanner) << "Ignoring file change with unchanged content:" << name;
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->filesChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -237,6 +244,11 @@ void EngineGeneration::onDirectoryChanged() {
|
|||
// try to find any files that were just deleted from a replace operation
|
||||
for (auto& file: this->deletedWatchedFiles) {
|
||||
if (QFileInfo(file).exists()) {
|
||||
if (!this->scanner.hasFileContentChanged(file)) {
|
||||
qCDebug(logQmlScanner) << "Ignoring restored file with unchanged content:" << file;
|
||||
continue;
|
||||
}
|
||||
|
||||
emit this->filesChanged();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue