Waybar. Issue#1552. Calendar module, LC_TIME variable

This commit is contained in:
Viktar Lukashonak 2022-05-12 19:04:45 +03:00
parent 9bc821bdac
commit 7b7ee41e13
No known key found for this signature in database
GPG Key ID: 08A413AA87200A6F
1 changed files with 8 additions and 1 deletions

View File

@ -69,7 +69,14 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
if (config_["locale"].isString()) { if (config_["locale"].isString()) {
locale_ = std::locale(config_["locale"].asString()); locale_ = std::locale(config_["locale"].asString());
} else { } else {
locale_ = std::locale(""); char* sysLocale{getenv("LC_TIME")};
try {
locale_ = sysLocale ? std::locale(sysLocale) : std::locale("");
}
catch(std::runtime_error const& localeErr) {
spdlog::warn(localeErr.what());
locale_ = std::locale();
}
} }
thread_ = [this] { thread_ = [this] {