packages feed

xnobar-0.0.0.2: exe/Echo.hs

import Control.Exception (finally)
import Control.Monad (forever)
import XNobar.Internal.Scroller
import XNobar.Server
import Xmobar (tenthSeconds)

main :: IO ()
main = do
  putStrLn "Starting the server"
  startServer >>= \case Left err -> print err
                        Right (notifs, stopServer) -> do
                          putStrLn "Fetching notifications"
                          (forever $ do
                            ns <- fetch notifs
                            tenthSeconds 1
                            print $ (show . snd) <$> ns)
                            -- TODO: even without this, I observe the exact same behavior
                            -- `finally` do putStrLn "Stopping the server"
                                         -- stopServer