{-# LANGUAGE OverloadedStrings #-} module RsiBreak.RealMain (realMain) where import Data.String (IsString (..)) import Monomer import Paths_rsi_break import RsiBreak.Actions (getOrCreateConfigFile) import RsiBreak.Widget.Clockdown qualified as Clockdown import RsiBreak.Widget.Timer qualified as Timer realMain :: IO () realMain :: IO () realMain = do TimerSetting timerSettings <- IO TimerSetting getOrCreateConfigFile let model :: ClockModel model = Text -> TimerState -> TimerSetting -> ClockModel Clockdown.ClockModel Text "0:00" TimerState Timer.TimerNoWait TimerSetting timerSettings Text windowIconPath <- String -> Text forall a. IsString a => String -> a fromString (String -> Text) -> IO String -> IO Text forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> String -> IO String getDataFileName String "assets/images/icon.png" Text robotoRegularFont <- String -> Text forall a. IsString a => String -> a fromString (String -> Text) -> IO String -> IO Text forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> String -> IO String getDataFileName String "assets/fonts/Roboto-Regular.ttf" let cfg :: [AppConfig e] cfg = Text -> Text -> [AppConfig e] forall {e}. Text -> Text -> [AppConfig e] config Text windowIconPath Text robotoRegularFont ClockModel -> AppEventHandler ClockModel ClockEvent -> AppUIBuilder ClockModel ClockEvent -> [AppConfig ClockEvent] -> IO () forall s e. (Eq s, WidgetModel s, WidgetEvent e) => s -> AppEventHandler s e -> AppUIBuilder s e -> [AppConfig e] -> IO () startApp ClockModel model AppEventHandler ClockModel ClockEvent forall es ep. EventHandler ClockModel ClockEvent es ep Clockdown.handleEvent AppUIBuilder ClockModel ClockEvent Clockdown.buildUI [AppConfig ClockEvent] forall {e}. [AppConfig e] cfg where config :: Text -> Text -> [AppConfig e] config Text icon' Text roboto = [ Text -> AppConfig e forall e. Text -> AppConfig e appWindowTitle Text "RSI Break" , Text -> AppConfig e forall e. Text -> AppConfig e appWindowIcon Text icon' , Theme -> AppConfig e forall e. Theme -> AppConfig e appTheme Theme darkTheme , Text -> Text -> AppConfig e forall e. Text -> Text -> AppConfig e appFontDef Text "Regular" Text roboto ]