mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 21:13:48 -07:00
core: add a few festive splashes
adds two new 'special' splash types for xmas and new years. Activated based on local time.
This commit is contained in:
@@ -206,11 +206,21 @@ CCompositor::~CCompositor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::setRandomSplash() {
|
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::random_device dev;
|
||||||
std::mt19937 engine(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<SP<Aquamarine::IOutput>> pendingOutputs;
|
static std::vector<SP<Aquamarine::IOutput>> pendingOutputs;
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace NSplashes {
|
||||||
inline const std::vector<std::string> SPLASHES = {
|
inline const std::vector<std::string> SPLASHES = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
"Woo, animations!",
|
"Woo, animations!",
|
||||||
@@ -80,3 +81,34 @@ inline const std::vector<std::string> SPLASHES = {
|
|||||||
"2 years!"
|
"2 years!"
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline const std::vector<std::string> SPLASHES_CHRISTMAS = {
|
||||||
|
// clang-format off
|
||||||
|
"Merry Christmas!",
|
||||||
|
"Merry Xmas!",
|
||||||
|
"Ho ho ho",
|
||||||
|
"Santa was here",
|
||||||
|
// clang-format on
|
||||||
|
};
|
||||||
|
|
||||||
|
// ONLY valid near new years.
|
||||||
|
inline static int newYear = []() -> int {
|
||||||
|
auto tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||||
|
auto local = *localtime(&tt);
|
||||||
|
|
||||||
|
if (local.tm_mon < 8 /* decided with a fair die I promise. */)
|
||||||
|
return local.tm_year + 1900;
|
||||||
|
return local.tm_year + 1901;
|
||||||
|
}();
|
||||||
|
|
||||||
|
inline const std::vector<std::string> SPLASHES_NEWYEAR = {
|
||||||
|
// clang-format off
|
||||||
|
"Happy new Year!",
|
||||||
|
"[New year] will be the year of the Linux desktop!",
|
||||||
|
"[New year] will be the year of the Hyprland desktop!",
|
||||||
|
std::format("{} will be the year of the Linux desktop!", newYear),
|
||||||
|
std::format("{} will be the year of the Hyprland desktop!", newYear),
|
||||||
|
std::format("Let's make {} even better than {}!", newYear, newYear - 1),
|
||||||
|
// clang-format on
|
||||||
|
};
|
||||||
|
};
|
Reference in New Issue
Block a user