Skip to content
Snippets Groups Projects
Commit 275d699b authored by Jens Nolte's avatar Jens Nolte
Browse files

Use new timer infrastructure for date block

parent e6686611
No related branches found
No related tags found
No related merge requests found
......@@ -7,19 +7,12 @@ import QBar.Time
import qualified Data.Text.Lazy as T
import Data.Time.Format
import Data.Time.LocalTime
import Control.Lens
dateBlock :: PushBlock
dateBlock = forever $ do
updateBlock =<< liftIO dateBlockOutput
sleepUntilInterval everyMinute
dateBlockOutput :: IO BlockOutput
dateBlockOutput = do
zonedTime <- getZonedTime
dateBlock = schedulePullBlock' (everyNSeconds 60) $ forever $ do
zonedTime <- liftIO getZonedTime
let date = T.pack (formatTime defaultTimeLocale "%a %F" zonedTime)
let time = T.pack (formatTime defaultTimeLocale "%R" zonedTime)
let text = normalText ("📅\xFE0E " <> date <> " ") <> activeText time
return $ blockName ?~ "date" $ mkBlockOutput text
updateBlock $ mkBlockOutput text
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment