diff options
-rw-r--r-- | src/config/ConfigManager.cpp | 2 | ||||
-rw-r--r-- | src/render/OpenGL.cpp | 34 |
2 files changed, 20 insertions, 16 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index b675f6ea..23efe77e 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -91,8 +91,8 @@ void CConfigManager::setDefaultVars() { configValues["misc:disable_hyprland_logo"].intValue = 0; configValues["misc:disable_splash_rendering"].intValue = 0; - configValues["misc:disable_hypr_chan"].intValue = 0; configValues["misc:force_hypr_chan"].intValue = 0; + configValues["misc:force_default_wallpaper"].intValue = -1; configValues["misc:vfr"].intValue = 1; configValues["misc:vrr"].intValue = 0; configValues["misc:mouse_move_enables_dpms"].intValue = 0; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 5d513f31..64703205 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1762,34 +1762,37 @@ void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!"); - static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue; - static auto* const PDISABLEHYPRCHAN = &g_pConfigManager->getConfigValuePtr("misc:disable_hypr_chan")->intValue; - static auto* const PFORCEHYPRCHAN = &g_pConfigManager->getConfigValuePtr("misc:force_hypr_chan")->intValue; + static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue; + static auto* const PFORCEHYPRCHAN = &g_pConfigManager->getConfigValuePtr("misc:force_hypr_chan")->intValue; + static auto* const PFORCEWALLPAPER = &g_pConfigManager->getConfigValuePtr("misc:force_default_wallpaper")->intValue; - std::random_device dev; - std::mt19937 engine(dev()); - std::uniform_int_distribution<> distribution(0, 2); - std::uniform_int_distribution<> distribution2(0, 1); - - const bool USEANIME = *PFORCEHYPRCHAN || distribution(engine) == 0; // 66% for anime + const auto FORCEWALLPAPER = std::clamp(*PFORCEWALLPAPER, -1L, 2L); // release the last tex if exists const auto PTEX = &m_mMonitorBGTextures[pMonitor]; PTEX->destroyTexture(); PTEX->allocate(); - Debug::log(LOG, "Allocated texture for BGTex"); // TODO: use relative paths to the installation // or configure the paths at build time + std::string texPath = "/usr/share/hyprland/wall_"; + std::string prefixes[] = {"", "anime_", "anime2_"}; // get the adequate tex - std::string texPath = "/usr/share/hyprland/wall_"; - if (!*PDISABLEHYPRCHAN) - texPath += std::string(USEANIME ? (distribution2(engine) == 0 ? "anime_" : "anime2_") : ""); - - // check if wallpapers exist + if (FORCEWALLPAPER == -1) { + std::random_device dev; + std::mt19937 engine(dev()); + std::uniform_int_distribution<> distribution(0, 2); + std::uniform_int_distribution<> distribution_anime(1, 2); + + if (PFORCEHYPRCHAN) + texPath += prefixes[distribution_anime(engine)]; + else + texPath += prefixes[distribution(engine)]; + } else + texPath += prefixes[FORCEWALLPAPER]; Vector2D textureSize; if (pMonitor->vecTransformedSize.x > 3850) { @@ -1803,6 +1806,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { texPath += "2K.png"; } + // check if wallpapers exist if (!std::filesystem::exists(texPath)) { // try local texPath = texPath.substr(0, 5) + "local/" + texPath.substr(5); |