From 7d1092db045ad5b20dbdde1ec1fb0bf2f5195267 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Mon, 5 Dec 2016 04:45:01 +0100 Subject: [PATCH] refactor(date): Add label and date/time tokens Ref #225 --- examples/config.cmake | 12 +++++- include/modules/date.hpp | 21 +++++++--- src/modules/date.cpp | 83 ++++++++++++++++++++++++++-------------- 3 files changed, 81 insertions(+), 35 deletions(-) diff --git a/examples/config.cmake b/examples/config.cmake index de0b09cd..4cff7b0f 100644 --- a/examples/config.cmake +++ b/examples/config.cmake @@ -231,12 +231,20 @@ label-disconnected-foreground = ${colors.foreground-alt} [module/date] type = internal/date -date = %H:%M interval = 5 -format-prefix = " " + +date = +date-alt = " %Y-%m-%d" + +time = %H:%M +time-alt = %H:%M:%S + +format-prefix =  format-prefix-foreground = ${colors.foreground-alt} format-underline = #0a6cf5 +label = %date% %time% + [module/volume] type = internal/volume diff --git a/include/modules/date.hpp b/include/modules/date.hpp index 8b1315d8..aab752d0 100644 --- a/include/modules/date.hpp +++ b/include/modules/date.hpp @@ -13,16 +13,27 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; bool handle_event(string cmd); - bool receive_events() const; + bool receive_events() const { + return true; + } private: - static constexpr auto TAG_DATE = ""; + static constexpr auto TAG_LABEL = "