From fb88c06d78cebe49310530268fee3c928fe5c239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Peter=20Dhall=C3=A9?= Date: Mon, 15 Apr 2024 21:59:35 +0200 Subject: [PATCH] calendar: add shift_reset action --- include/modules/clock.hpp | 2 ++ src/modules/clock.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/modules/clock.hpp b/include/modules/clock.hpp index e7c3872c..9e10fb85 100644 --- a/include/modules/clock.hpp +++ b/include/modules/clock.hpp @@ -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}}; }; diff --git a/src/modules/clock.cpp b/src/modules/clock.cpp index 83537405..9f26b51f 100644 --- a/src/modules/clock.cpp +++ b/src/modules/clock.cpp @@ -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;