mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(wallpaper): preserve automation schedule across config reloads
This commit is contained in:
@@ -217,6 +217,7 @@ bool Wallpaper::initialize(WaylandConnection& wayland, ConfigService* config, Re
|
||||
m_textureCache = textureCache;
|
||||
|
||||
if (!m_config->config().wallpaper.enabled) {
|
||||
m_wallpaperEnabled = false;
|
||||
kLog.info("disabled in config");
|
||||
return true;
|
||||
}
|
||||
@@ -232,6 +233,7 @@ bool Wallpaper::initialize(WaylandConnection& wayland, ConfigService* config, Re
|
||||
});
|
||||
|
||||
resetAutomationState();
|
||||
m_wallpaperEnabled = true;
|
||||
syncInstances();
|
||||
return true;
|
||||
}
|
||||
@@ -239,10 +241,12 @@ bool Wallpaper::initialize(WaylandConnection& wayland, ConfigService* config, Re
|
||||
void Wallpaper::reload() {
|
||||
kLog.info("reloading config");
|
||||
|
||||
const bool wasEnabled = m_wallpaperEnabled;
|
||||
const bool nowEnabled = m_config->config().wallpaper.enabled;
|
||||
resetAutomationState();
|
||||
|
||||
if (!nowEnabled) {
|
||||
resetAutomationState();
|
||||
m_wallpaperEnabled = false;
|
||||
// Wallpaper disabled — full teardown
|
||||
for (auto& inst : m_instances) {
|
||||
releaseInstanceTextures(*inst);
|
||||
@@ -251,6 +255,11 @@ void Wallpaper::reload() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wasEnabled) {
|
||||
resetAutomationState();
|
||||
}
|
||||
m_wallpaperEnabled = true;
|
||||
|
||||
// Wallpaper remains (or becomes) enabled — sync instances without teardown
|
||||
// to avoid flickering. syncInstances handles monitor override changes
|
||||
// (adds/removes instances) without disturbing existing surfaces.
|
||||
|
||||
@@ -45,6 +45,7 @@ private:
|
||||
ConfigService* m_config = nullptr;
|
||||
RenderContext* m_renderContext = nullptr;
|
||||
SharedTextureCache* m_textureCache = nullptr;
|
||||
bool m_wallpaperEnabled = false;
|
||||
std::int64_t m_lastAutomationMinuteStamp = -1;
|
||||
std::int64_t m_lastAutomationSwitchMinute = -1;
|
||||
Signal<>::ScopedConnection m_paletteConn;
|
||||
|
||||
Reference in New Issue
Block a user