From 22f7d6f1424c296b297df87bf2accdfefac4af33 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 5 Dec 2024 01:59:29 +0000 Subject: core: add a few festive splashes adds two new 'special' splash types for xmas and new years. Activated based on local time. --- src/Compositor.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 3573996d..1261d003 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -206,11 +206,21 @@ CCompositor::~CCompositor() { } void CCompositor::setRandomSplash() { + auto tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + auto local = *localtime(&tt); + + const auto* SPLASHES = &NSplashes::SPLASHES; + + if (local.tm_mon + 1 == 12 && local.tm_mday >= 23 && local.tm_mday <= 27) // dec 23-27 + SPLASHES = &NSplashes::SPLASHES_CHRISTMAS; + if ((local.tm_mon + 1 == 12 && local.tm_mday >= 29) || (local.tm_mon + 1 == 1 && local.tm_mday <= 3)) + SPLASHES = &NSplashes::SPLASHES_NEWYEAR; + std::random_device dev; std::mt19937 engine(dev()); - std::uniform_int_distribution<> distribution(0, SPLASHES.size() - 1); + std::uniform_int_distribution<> distribution(0, SPLASHES->size() - 1); - m_szCurrentSplash = SPLASHES[distribution(engine)]; + m_szCurrentSplash = SPLASHES->at(distribution(engine)); } static std::vector> pendingOutputs; -- cgit v1.2.3