From a6a65cb6b79e8871ae82a7451c1cbc5cdb96774e Mon Sep 17 00:00:00 2001 From: Prakhar Chhalotre Date: Tue, 10 Feb 2026 18:59:56 +0530 Subject: [PATCH] feat: add support for configurable first day of the week in calendar --- src/modules/clock.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/clock.cpp b/src/modules/clock.cpp index 5fe5407b..b71b2615 100644 --- a/src/modules/clock.cpp +++ b/src/modules/clock.cpp @@ -509,6 +509,18 @@ using deleting_unique_ptr = std::unique_ptr>; // Computations done similarly to Linux cal utility. auto waybar::modules::Clock::first_day_of_week() -> weekday { + const auto firstdow = config_[kCldPlaceholder]["first-day-of-week"]; + if (firstdow.isInt()) { + const int firstDay = firstdow.asInt(); + if (!(firstDay >= 0 && firstDay <= 6)) { + spdlog::warn( + "Clock calender configuration first-day-of-week = {0} must be in range [0, 6]. Default " + "value is used instead", + firstDay); + } else { + return weekday{static_cast(firstDay)}; + } + } if (iso8601Calendar_) { return Monday; }