summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-07-13 14:32:30 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-07-13 14:32:30 +0200
commit70dae78c1b5b17288a3e343b87ca6d10244ee937 (patch)
treee04a37d3f230b0d8bb1eaa2066bf26a1e4cffcda
parent5e577acf516b80173f695a458c2cc188a4d64560 (diff)
background: add mascot versions
-rw-r--r--Makefile3
-rw-r--r--assets/wall_anime_2K.pngbin0 -> 514144 bytes
-rw-r--r--assets/wall_anime_4K.pngbin0 -> 1427703 bytes
-rw-r--r--assets/wall_anime_8K.pngbin0 -> 1700093 bytes
-rw-r--r--src/render/OpenGL.cpp25
5 files changed, 22 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 380d5b0a..ff383ef7 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/assets/wall_anime_2K.png b/assets/wall_anime_2K.png
new file mode 100644
index 00000000..202dc493
--- /dev/null
+++ b/assets/wall_anime_2K.png
Binary files differ
diff --git a/assets/wall_anime_4K.png b/assets/wall_anime_4K.png
new file mode 100644
index 00000000..687b79c3
--- /dev/null
+++ b/assets/wall_anime_4K.png
Binary files differ
diff --git a/assets/wall_anime_8K.png b/assets/wall_anime_8K.png
new file mode 100644
index 00000000..25c15cd7
--- /dev/null
+++ b/assets/wall_anime_8K.png
Binary files differ
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 9810a6fb..b3688a17 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -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)),
@@ -1547,7 +1548,13 @@ 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 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];
@@ -1560,13 +1567,11 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
// TODO: use relative paths to the installation
// or configure the paths at build time
+ // get the adequate tex
+ std::string texPath = "/usr/share/hyprland/wall_" + std::string(USEANIME ? "anime_" : "");
// 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_";
- Vector2D textureSize;
+ Vector2D textureSize;
if (pMonitor->vecTransformedSize.x > 3850) {
textureSize = Vector2D(7680, 4320);
texPath += "8K.png";
@@ -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