{-# LANGUAGE CPP #-}
module Shrun.Configuration.Data.Notify.System
(
parseNotifySystem,
notifySystemMeta,
mergeNotifySystem,
defNotifySystemStr,
)
where
import Shrun.Configuration.Default (Default (def))
import Shrun.Prelude
import Shrun.Utils qualified as Utils
mergeNotifySystem ::
Maybe NotifySystem ->
Maybe NotifySystem ->
NotifySystem
mergeNotifySystem :: Maybe NotifySystem -> Maybe NotifySystem -> NotifySystem
mergeNotifySystem Maybe NotifySystem
mArgs Maybe NotifySystem
mToml =
case Maybe NotifySystem
mArgs of
Just NotifySystem
s -> NotifySystem
s
Maybe NotifySystem
Nothing -> case Maybe NotifySystem
mToml of
Just NotifySystem
t -> NotifySystem
t
Maybe NotifySystem
Nothing -> NotifySystem
defaultNotifySystem
parseNotifySystem :: (MonadFail m) => m Text -> m NotifySystem
parseNotifySystem :: forall (m :: Type -> Type). MonadFail m => m Text -> m NotifySystem
parseNotifySystem = (m Text -> (Text -> m NotifySystem) -> m NotifySystem
forall a b. m a -> (a -> m b) -> m b
forall (m :: Type -> Type) a b. Monad m => m a -> (a -> m b) -> m b
>>= (NotifySystem -> Text)
-> Text -> (Bool, [Text]) -> Text -> m NotifySystem
forall a (m :: Type -> Type).
(Bounded a, Enum a, MonadFail m) =>
(a -> Text) -> Text -> (Bool, [Text]) -> Text -> m a
Utils.inverseMapFail NotifySystem -> Text
forall a. Display a => a -> Text
display Text
"notify-system" (Bool, [Text])
forall a. IsString a => (Bool, [a])
notifySystemMeta)
{-# INLINEABLE parseNotifySystem #-}
notifySystemMeta :: (IsString a) => Tuple2 Bool (List a)
notifySystemMeta :: forall a. IsString a => (Bool, [a])
notifySystemMeta = (Bool
False, [a
"apple-script", a
"dbus", a
"notify-send"])
defNotifySystemStr :: Text
defNotifySystemStr :: Text
defNotifySystemStr = forall a. Display a => a -> Text
display @NotifySystem NotifySystem
forall a. Default a => a
def