clock: allow custom formatting for today in calendar
parent
31243cdc20
commit
8cd6e13308
|
@ -31,6 +31,11 @@ The *clock* module displays the current date and time.
|
||||||
default: inferred from current locale ++
|
default: inferred from current locale ++
|
||||||
A locale to be used to display the time. Intended to render times in custom timezones with the proper language and format.
|
A locale to be used to display the time. Intended to render times in custom timezones with the proper language and format.
|
||||||
|
|
||||||
|
*today-format*: ++
|
||||||
|
typeof: string ++
|
||||||
|
default: <b><u>{}</u></b> ++
|
||||||
|
The format of today's date in the calendar.
|
||||||
|
|
||||||
*max-length*: ++
|
*max-length*: ++
|
||||||
typeof: integer ++
|
typeof: integer ++
|
||||||
The maximum length in character the module should display.
|
The maximum length in character the module should display.
|
||||||
|
|
|
@ -99,7 +99,12 @@ auto waybar::modules::Clock::calendar_text(const waybar_time& wtime) -> std::str
|
||||||
os << '\n';
|
os << '\n';
|
||||||
}
|
}
|
||||||
if (d == curr_day) {
|
if (d == curr_day) {
|
||||||
os << "<b><u>" << date::format("%e", d) << "</u></b>";
|
if (config_["today-format"].isString()) {
|
||||||
|
auto today_format = config_["today-format"].asString();
|
||||||
|
os << fmt::format(today_format, date::format("%e", d));
|
||||||
|
} else {
|
||||||
|
os << "<b><u>" << date::format("%e", d) << "</u></b>";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
os << date::format("%e", d);
|
os << date::format("%e", d);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue