Merge pull request #3142 from janpeterd/master

calendar: add shift_reset action
master
Alexis Rouillard 2024-04-15 22:18:17 +02:00 committed by GitHub
commit 3efebc2822
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class Clock final : public ALabel {
void cldModeSwitch();
void cldShift_up();
void cldShift_down();
void cldShift_reset();
void tz_up();
void tz_down();
// Module Action Map
@ -80,6 +81,7 @@ class Clock final : public ALabel {
{"mode", &waybar::modules::Clock::cldModeSwitch},
{"shift_up", &waybar::modules::Clock::cldShift_up},
{"shift_down", &waybar::modules::Clock::cldShift_down},
{"shift_reset", &waybar::modules::Clock::cldShift_reset},
{"tz_up", &waybar::modules::Clock::tz_up},
{"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() {
cldCurrShift_ -= (months)((cldMode_ == CldMode::YEAR) ? 12 : 1) * cldShift_;
}
void waybar::modules::Clock::cldShift_reset() {
cldCurrShift_ = (months)0;
}
void waybar::modules::Clock::tz_up() {
const auto tzSize{tzList_.size()};
if (tzSize == 1) return;