mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-09 20:49:49 +01: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:
parent
f9e4998a6d
commit
22f7d6f142
2 changed files with 120 additions and 78 deletions
|
@ -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<SP<Aquamarine::IOutput>> pendingOutputs;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace NSplashes {
|
||||
inline const std::vector<std::string> SPLASHES = {
|
||||
// clang-format off
|
||||
"Woo, animations!",
|
||||
|
@ -80,3 +81,34 @@ inline const std::vector<std::string> SPLASHES = {
|
|||
"2 years!"
|
||||
// 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
|
||||
};
|
||||
};
|
Loading…
Reference in a new issue