From 7b7ee41e13372fbbbb0fb5ab49cb95cbfd02577c Mon Sep 17 00:00:00 2001 From: Viktar Lukashonak Date: Thu, 12 May 2022 19:04:45 +0300 Subject: [PATCH] Waybar. Issue#1552. Calendar module, LC_TIME variable --- src/modules/clock.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/clock.cpp b/src/modules/clock.cpp index 69fdebb1..c4c460cc 100644 --- a/src/modules/clock.cpp +++ b/src/modules/clock.cpp @@ -69,7 +69,14 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config) if (config_["locale"].isString()) { locale_ = std::locale(config_["locale"].asString()); } 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] {