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_4K.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
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 "../helpers/MiscFunctions.hpp"
#include "Shaders.hpp"
#include <random>
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)),
@ -1549,6 +1550,12 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
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
const auto PTEX = &m_mMonitorBGTextures[pMonitor];
PTEX->destroyTexture();
@ -1560,12 +1567,10 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
// TODO: use relative paths to the installation
// 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
std::string texPath = "/usr/share/hyprland/wall_";
std::string texPath = "/usr/share/hyprland/wall_" + std::string(USEANIME ? "anime_" : "");
// check if wallpapers exist
Vector2D textureSize;
if (pMonitor->vecTransformedSize.x > 3850) {
textureSize = Vector2D(7680, 4320);
@ -1578,6 +1583,14 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
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;
// calc the target box