diff options
Diffstat (limited to 'app/Main.hs')
| -rw-r--r-- | app/Main.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/Main.hs b/app/Main.hs index 3b41690..573e6a1 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -8,6 +8,7 @@ module Main where +import Control.Arrow import Control.Concurrent import Control.Exception import Control.Monad @@ -63,7 +64,7 @@ type Colors = M.Map (P.Intensity, P.Color) X.XftColor data State = State { dirty :: Bool, - ui :: Ui (S.Sensor (S.SensorT IO) () (Block P.Doc)) + ui :: Ui (S.Sensor () (Block P.Doc)) } main :: IO () @@ -76,7 +77,8 @@ run :: Env -> TVar State -> Colors -> IO () run env stateT colors = do -- XXX `ui` lives in state, but we treat is as if it was constant -- XXX this is supposed to NOT wait for the next event if `state.dirty` - S.runSensorT . S.sample' go . pollUi . (.ui) =<< atomically do readTVar stateT + state <- atomically $ readTVar stateT + S.reactimateS (pollUi state.ui >>> S.arrS (go Nothing)) where go Nothing pUi = do atomically do @@ -181,8 +183,7 @@ createWindow args = do drw <- X.xftDrawCreate dpy pixm vis cmap X.mapWindow dpy win let dirty = True - let ui :: Ui (S.Sensor (S.SensorT IO) () (Block P.Doc)) - ui = + let ui = Ui $ intercalate [pure (lit " ")] $ [ [lit <$> wmWorkspaces], @@ -196,8 +197,7 @@ createWindow args = do [pure (lit " "), lit <$> thermal], [pure (lit " "), lit <$> bat], [lit <$> weatherForecast], - [pure (lit " "), lit <$> date, pure (lit ", "), lit <$> time], - [] + [pure (lit " "), lit <$> date, pure (lit ", "), lit <$> time] ] xcolors <- do X.rmInitialize |
