diff --git a/app/Main.hs b/app/Main.hs index 1aa42b0923dce019a467df72fe88294e432c0544..8a4c11dbd846e2fbeb8604e395a24ca4e51e26ee 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -3,4 +3,4 @@ module Main where import QBar.Cli main :: IO () -main = runQBar \ No newline at end of file +main = runQBar diff --git a/src/QBar/Blocks/Battery.hs b/src/QBar/Blocks/Battery.hs index f7d0358d71cb02702bbcb08c1e34086718b1c60f..cddb65a0ae6b1cd293b8513d382f206fe2ae9284 100644 --- a/src/QBar/Blocks/Battery.hs +++ b/src/QBar/Blocks/Battery.hs @@ -52,12 +52,11 @@ getBatteryState path = tryMaybe $ do batteryBlock :: PullBlock -batteryBlock = do +batteryBlock = forever $ do batteryPaths <- liftIO $ map ((apiPath <> "/") <>) . filter (T.isPrefixOf "BAT" . T.pack) <$> getDirectoryContents apiPath batteryStates <- liftIO $ mapM getBatteryState batteryPaths isPlugged <- liftIO getPluggedState updateBatteryBlock isPlugged $ catMaybes batteryStates - batteryBlock where apiPath :: FilePath apiPath = "/sys/class/power_supply" diff --git a/src/QBar/Blocks/Date.hs b/src/QBar/Blocks/Date.hs index a8658d1482fbbd174a2df5387bf4f2cd8f3291d3..d640647706613b620f779613249815d761e10209 100644 --- a/src/QBar/Blocks/Date.hs +++ b/src/QBar/Blocks/Date.hs @@ -11,10 +11,9 @@ import Control.Lens dateBlock :: PushBlock -dateBlock = do +dateBlock = forever $ do updateBlock =<< liftIO dateBlockOutput - liftIO $ sleepUntil =<< nextMinute - dateBlock + sleepUntilInterval everyMinute dateBlockOutput :: IO BlockOutput