{-# LANGUAGE CPP #-}
module Effectful.Notify.Internal.Data.NotifyEnv
( NotifyEnv (..),
notifyEnvToSystemOs,
)
where
#if LINUX
import DBus.Client (Client)
#endif
import Data.Text.Display (Display (displayBuilder))
import Effectful.Notify.Internal.Data.NotifySystem (NotifySystemOs)
import Effectful.Notify.Internal.Data.NotifySystem qualified as System
notifyEnvToSystemOs :: NotifyEnv -> NotifySystemOs
#if LINUX
data NotifyEnv
= NotifyEnvDBus Client
| NotifyEnvNotifySend
instance Show NotifyEnv where
show :: NotifyEnv -> String
show (NotifyEnvDBus Client
_) = String
"NotifyEnvDBus"
show NotifyEnv
NotifyEnvNotifySend = String
"NotifyEnvNotifySend"
instance Display NotifyEnv where
displayBuilder :: NotifyEnv -> Builder
displayBuilder = \case
NotifyEnvDBus Client
_ -> Builder
"dbus"
NotifyEnv
NotifyEnvNotifySend -> Builder
"notify-send"
notifyEnvToSystemOs :: NotifyEnv -> NotifySystemOs
notifyEnvToSystemOs = \case
NotifyEnvDBus Client
_ -> NotifySystemOs
System.NotifySystemOsDBus
NotifyEnv
NotifyEnvNotifySend -> NotifySystemOs
System.NotifySystemOsNotifySend
#elif OSX
data NotifyEnv = NotifyEnvAppleScript
instance Show NotifyEnv where
show NotifyEnvAppleScript = "NotifyEnvAppleScript"
instance Display NotifyEnv where
displayBuilder = \case
NotifyEnvAppleScript -> "apple-script"
notifyEnvToSystemOs = \case
NotifyEnvAppleScript -> System.NotifySystemOsAppleScript
#else
data NotifyEnv = NotifyEnvWindows
instance Show NotifyEnv where
show NotifyEnvWindows = "NotifyEnvWindows"
instance Display NotifyEnv where
displayBuilder = \case
NotifyEnvWindows -> "windows"
notifyEnvToSystemOs = \case
NotifyEnvWindows -> System.NotifySystemOsWindows
#endif