diff --git a/src/renderer/widgets/Background.cpp b/src/renderer/widgets/Background.cpp index f342474..7319eed 100644 --- a/src/renderer/widgets/Background.cpp +++ b/src/renderer/widgets/Background.cpp @@ -1,7 +1,8 @@ #include "Background.hpp" #include "../Renderer.hpp" #include "../../core/hyprlock.hpp" -#include "src/helpers/Log.hpp" +#include "../../helpers/Log.hpp" +#include "../../helpers/MiscFunctions.hpp" #include #include #include @@ -39,7 +40,7 @@ CBackground::CBackground(const Vector2D& viewport_, COutput* output_, const std: path = std::any_cast(props.at("path")); reloadCommand = std::any_cast(props.at("reload_cmd")); reloadTime = std::any_cast(props.at("reload_time")); - crossFadeTime = std::any_cast(props.at("crossfade_time")); + crossFadeTime = std::any_cast(props.at("crossfade_time")); } catch (const std::bad_any_cast& e) { RASSERT(false, "Failed to construct CBackground: {}", e.what()); // @@ -47,12 +48,13 @@ CBackground::CBackground(const Vector2D& viewport_, COutput* output_, const std: RASSERT(false, "Missing propperty for CBackground: {}", e.what()); // } - try { - modificationTime = std::filesystem::last_write_time(path); - } catch (std::exception& e) { Debug::log(ERR, "{}", e.what()); } + if (!isScreenshot && reloadTime > -1) { + try { + modificationTime = std::filesystem::last_write_time(absolutePath(path, "")); + } catch (std::exception& e) { Debug::log(ERR, "{}", e.what()); } - if (!isScreenshot) plantReloadTimer(); // No reloads for screenshots. + } } void CBackground::renderRect(CColor color) { @@ -139,15 +141,14 @@ bool CBackground::draw(const SRenderData& data) { if (fade) g_pRenderer->renderTextureMix(texbox, asset->texture, pendingAsset->texture, 1.0, - std::chrono::duration_cast(std::chrono::system_clock::now() - fade->start).count() / (1000 * crossFadeTime), - 0, HYPRUTILS_TRANSFORM_NORMAL); + std::chrono::duration_cast(std::chrono::system_clock::now() - fade->start).count() / (1000 * crossFadeTime), 0, + HYPRUTILS_TRANSFORM_NORMAL); else g_pRenderer->renderTexture(texbox, asset->texture, 1.0, 0, isScreenshot ? wlTransformToHyprutils(invertTransform(output->transform)) : HYPRUTILS_TRANSFORM_NORMAL); // this could be omitted but whatever it's only once and makes code cleaner plus less blurring on large texs - if (blurPasses > 0) g_pRenderer->blurFB(blurredFB, CRenderer::SBlurParams{blurSize, blurPasses, noise, contrast, brightness, vibrancy, vibrancy_darkness}); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); @@ -222,7 +223,7 @@ void CBackground::onReloadTimerUpdate() { } try { - const auto MTIME = std::filesystem::last_write_time(path); + const auto MTIME = std::filesystem::last_write_time(absolutePath(path, "")); if (OLDPATH == path && MTIME == modificationTime) return; diff --git a/src/renderer/widgets/Image.cpp b/src/renderer/widgets/Image.cpp index db531d1..7b01e8e 100644 --- a/src/renderer/widgets/Image.cpp +++ b/src/renderer/widgets/Image.cpp @@ -2,6 +2,7 @@ #include "../Renderer.hpp" #include "../../core/hyprlock.hpp" #include "../../helpers/Log.hpp" +#include "../../helpers/MiscFunctions.hpp" #include "../../config/ConfigDataValues.hpp" #include #include @@ -46,7 +47,7 @@ void CImage::onTimerUpdate() { } try { - const auto MTIME = std::filesystem::last_write_time(path); + const auto MTIME = std::filesystem::last_write_time(absolutePath(path, "")); if (OLDPATH == path && MTIME == modificationTime) return; @@ -101,13 +102,15 @@ CImage::CImage(const Vector2D& viewport_, COutput* output_, const std::string& r RASSERT(false, "Missing propperty for CImage: {}", e.what()); // } - try { - modificationTime = std::filesystem::last_write_time(path); - } catch (std::exception& e) { Debug::log(ERR, "{}", e.what()); } - angle = angle * M_PI / 180.0; - plantTimer(); + if (reloadTime > -1) { + try { + modificationTime = std::filesystem::last_write_time(absolutePath(path, "")); + } catch (std::exception& e) { Debug::log(ERR, "{}", e.what()); } + + plantTimer(); + } } bool CImage::draw(const SRenderData& data) {