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

Add 'updateBlockEmpty' to clear block output

parent 88e1ed56
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@ module QBar.Blocks.Battery where
import QBar.Core
import QBar.Blocks.Utils
import QBar.BlockOutput
import Pipes
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as TIO
......@@ -75,7 +74,7 @@ batteryBlock = forever $ do
updateBatteryBlock :: Bool -> [BatteryState] -> Block ()
updateBatteryBlock _ [] = yield Nothing
updateBatteryBlock _ [] = updateBlockEmpty
updateBatteryBlock isPlugged bs = updateBlock $ (shortText.~shortText') $ mkBlockOutput fullText'
where
fullText' :: BlockText
......
......@@ -138,6 +138,10 @@ updateBlock blockOutput = liftBlock . yield $ Just (blockOutput, Nothing)
updateBlock' :: MonadBlock m => BlockEventHandler -> BlockOutput -> m ()
updateBlock' blockEventHandler blockOutput = liftBlock . yield $ Just (blockOutput, Just blockEventHandler)
-- |Update a block by removing the current output
updateBlockEmpty :: MonadBlock m => m ()
updateBlockEmpty = liftBlock . yield $ Nothing
mkBlockState :: BlockOutput -> BlockState
mkBlockState blockOutput = Just (blockOutput, Nothing)
......
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