background: add mascot versions

This commit is contained in:
vaxerski 2023-07-13 14:32:30 +02:00
parent 5e577acf51
commit 70dae78c1b
5 changed files with 23 additions and 7 deletions

View file

@ -47,6 +47,9 @@ install:
cp ./assets/wall_2K.png ${PREFIX}/share/hyprland cp ./assets/wall_2K.png ${PREFIX}/share/hyprland
cp ./assets/wall_4K.png ${PREFIX}/share/hyprland cp ./assets/wall_4K.png ${PREFIX}/share/hyprland
cp ./assets/wall_8K.png ${PREFIX}/share/hyprland cp ./assets/wall_8K.png ${PREFIX}/share/hyprland
cp ./assets/wall_anime_2K.png ${PREFIX}/share/hyprland
cp ./assets/wall_anime_4K.png ${PREFIX}/share/hyprland
cp ./assets/wall_anime_8K.png ${PREFIX}/share/hyprland
mkdir -p ${PREFIX}/share/man/man1 mkdir -p ${PREFIX}/share/man/man1
install -m644 ./docs/*.1 ${PREFIX}/share/man/man1 install -m644 ./docs/*.1 ${PREFIX}/share/man/man1

BIN
assets/wall_anime_2K.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 KiB

BIN
assets/wall_anime_4K.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
assets/wall_anime_8K.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View file

@ -3,6 +3,7 @@
#include "../Compositor.hpp" #include "../Compositor.hpp"
#include "../helpers/MiscFunctions.hpp" #include "../helpers/MiscFunctions.hpp"
#include "Shaders.hpp" #include "Shaders.hpp"
#include <random>
CHyprOpenGLImpl::CHyprOpenGLImpl() { CHyprOpenGLImpl::CHyprOpenGLImpl() {
RASSERT(eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL)), RASSERT(eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL)),
@ -1547,7 +1548,13 @@ void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const
void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!");
static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue; static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue;
std::random_device dev;
std::mt19937 engine(dev());
std::uniform_int_distribution<> distribution(0, 10);
const bool USEANIME = distribution(engine) % 2 == 0; // about 50% I think
// release the last tex if exists // release the last tex if exists
const auto PTEX = &m_mMonitorBGTextures[pMonitor]; const auto PTEX = &m_mMonitorBGTextures[pMonitor];
@ -1560,13 +1567,11 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
// TODO: use relative paths to the installation // TODO: use relative paths to the installation
// or configure the paths at build time // or configure the paths at build time
// check if wallpapers exist
if (!std::filesystem::exists("/usr/share/hyprland/wall_8K.png"))
return; // the texture will be empty, oh well. We'll clear with a solid color anyways.
// get the adequate tex // get the adequate tex
std::string texPath = "/usr/share/hyprland/wall_"; std::string texPath = "/usr/share/hyprland/wall_" + std::string(USEANIME ? "anime_" : "");
Vector2D textureSize; // check if wallpapers exist
Vector2D textureSize;
if (pMonitor->vecTransformedSize.x > 3850) { if (pMonitor->vecTransformedSize.x > 3850) {
textureSize = Vector2D(7680, 4320); textureSize = Vector2D(7680, 4320);
texPath += "8K.png"; texPath += "8K.png";
@ -1578,6 +1583,14 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
texPath += "2K.png"; texPath += "2K.png";
} }
if (!std::filesystem::exists(texPath)) {
// try local
texPath = texPath.substr(0, 5) + "local/" + texPath.substr(5);
if (!std::filesystem::exists(texPath))
return; // the texture will be empty, oh well. We'll clear with a solid color anyways.
}
PTEX->m_vSize = textureSize; PTEX->m_vSize = textureSize;
// calc the target box // calc the target box