calendar: add shift_reset action

This commit is contained in:
Jan-Peter Dhallé 2024-04-15 21:59:35 +02:00
parent ddacb111a9
commit fb88c06d78
2 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class Clock final : public ALabel {
void cldModeSwitch(); void cldModeSwitch();
void cldShift_up(); void cldShift_up();
void cldShift_down(); void cldShift_down();
void cldShift_reset();
void tz_up(); void tz_up();
void tz_down(); void tz_down();
// Module Action Map // Module Action Map
@ -80,6 +81,7 @@ class Clock final : public ALabel {
{"mode", &waybar::modules::Clock::cldModeSwitch}, {"mode", &waybar::modules::Clock::cldModeSwitch},
{"shift_up", &waybar::modules::Clock::cldShift_up}, {"shift_up", &waybar::modules::Clock::cldShift_up},
{"shift_down", &waybar::modules::Clock::cldShift_down}, {"shift_down", &waybar::modules::Clock::cldShift_down},
{"shift_reset", &waybar::modules::Clock::cldShift_reset},
{"tz_up", &waybar::modules::Clock::tz_up}, {"tz_up", &waybar::modules::Clock::tz_up},
{"tz_down", &waybar::modules::Clock::tz_down}}; {"tz_down", &waybar::modules::Clock::tz_down}};
}; };

View File

@ -423,6 +423,9 @@ void waybar::modules::Clock::cldShift_up() {
void waybar::modules::Clock::cldShift_down() { void waybar::modules::Clock::cldShift_down() {
cldCurrShift_ -= (months)((cldMode_ == CldMode::YEAR) ? 12 : 1) * cldShift_; cldCurrShift_ -= (months)((cldMode_ == CldMode::YEAR) ? 12 : 1) * cldShift_;
} }
void waybar::modules::Clock::cldShift_reset() {
cldCurrShift_ = (months)0;
}
void waybar::modules::Clock::tz_up() { void waybar::modules::Clock::tz_up() {
const auto tzSize{tzList_.size()}; const auto tzSize{tzList_.size()};
if (tzSize == 1) return; if (tzSize == 1) return;