{-# LANGUAGE OverloadedStrings #-} module StatusNotifier.Watcher.Constants where import DBus.Client import DBus.Generation import DBus.Internal.Types import qualified DBus.Introspection as I import Data.Coerce import Data.String import StatusNotifier.Util import System.IO.Unsafe import System.Log.Logger import Text.Printf statusNotifierWatcherString :: String statusNotifierWatcherString :: String statusNotifierWatcherString = String "StatusNotifierWatcher" getWatcherInterfaceName :: String -> InterfaceName getWatcherInterfaceName :: String -> InterfaceName getWatcherInterfaceName String interfaceNamespace = String -> InterfaceName forall a. IsString a => String -> a fromString (String -> InterfaceName) -> String -> InterfaceName forall a b. (a -> b) -> a -> b $ String -> String -> String -> String forall r. PrintfType r => String -> r printf String "%s.%s" String interfaceNamespace String statusNotifierWatcherString data ItemEntry = ItemEntry { ItemEntry -> BusName serviceName :: BusName , ItemEntry -> ObjectPath servicePath :: ObjectPath } deriving (Int -> ItemEntry -> String -> String [ItemEntry] -> String -> String ItemEntry -> String (Int -> ItemEntry -> String -> String) -> (ItemEntry -> String) -> ([ItemEntry] -> String -> String) -> Show ItemEntry forall a. (Int -> a -> String -> String) -> (a -> String) -> ([a] -> String -> String) -> Show a showList :: [ItemEntry] -> String -> String $cshowList :: [ItemEntry] -> String -> String show :: ItemEntry -> String $cshow :: ItemEntry -> String showsPrec :: Int -> ItemEntry -> String -> String $cshowsPrec :: Int -> ItemEntry -> String -> String Show, ItemEntry -> ItemEntry -> Bool (ItemEntry -> ItemEntry -> Bool) -> (ItemEntry -> ItemEntry -> Bool) -> Eq ItemEntry forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: ItemEntry -> ItemEntry -> Bool $c/= :: ItemEntry -> ItemEntry -> Bool == :: ItemEntry -> ItemEntry -> Bool $c== :: ItemEntry -> ItemEntry -> Bool Eq) data WatcherParams = WatcherParams { WatcherParams -> String watcherNamespace :: String , WatcherParams -> String watcherPath :: String , WatcherParams -> IO () watcherStop :: IO () , WatcherParams -> Maybe Client watcherDBusClient :: Maybe Client } defaultWatcherParams :: WatcherParams defaultWatcherParams :: WatcherParams defaultWatcherParams = WatcherParams :: String -> String -> IO () -> Maybe Client -> WatcherParams WatcherParams { watcherNamespace :: String watcherNamespace = String "org.kde" , watcherStop :: IO () watcherStop = () -> IO () forall (m :: * -> *) a. Monad m => a -> m a return () , watcherPath :: String watcherPath = String "/StatusNotifierWatcher" , watcherDBusClient :: Maybe Client watcherDBusClient = Maybe Client forall a. Maybe a Nothing } defaultWatcherInterfaceName :: InterfaceName defaultWatcherInterfaceName = String -> InterfaceName getWatcherInterfaceName (String -> InterfaceName) -> String -> InterfaceName forall a b. (a -> b) -> a -> b $ WatcherParams -> String watcherNamespace WatcherParams defaultWatcherParams serviceArg :: SignalArg serviceArg = SignalArg :: String -> Type -> SignalArg I.SignalArg { signalArgName :: String I.signalArgName = String "service" , signalArgType :: Type I.signalArgType = Type TypeString } watcherSignals :: [Signal] watcherSignals = [ Signal :: MemberName -> [SignalArg] -> Signal I.Signal { signalName :: MemberName I.signalName = MemberName "StatusNotifierItemRegistered" , signalArgs :: [SignalArg] I.signalArgs = [SignalArg serviceArg] } , Signal :: MemberName -> [SignalArg] -> Signal I.Signal { signalName :: MemberName I.signalName = MemberName "StatusNotifierItemUnregistered" , signalArgs :: [SignalArg] I.signalArgs = [SignalArg serviceArg] } , Signal :: MemberName -> [SignalArg] -> Signal I.Signal { signalName :: MemberName I.signalName = MemberName "StatusNotifierHostRegistered" , signalArgs :: [SignalArg] I.signalArgs = [] } ] watcherClientGenerationParams :: GenerationParams watcherClientGenerationParams = GenerationParams defaultGenerationParams { genBusName :: Maybe BusName genBusName = BusName -> Maybe BusName forall a. a -> Maybe a Just (BusName -> Maybe BusName) -> BusName -> Maybe BusName forall a b. (a -> b) -> a -> b $ String -> BusName forall a. IsString a => String -> a fromString (String -> BusName) -> String -> BusName forall a b. (a -> b) -> a -> b $ InterfaceName -> String coerce (InterfaceName -> String) -> InterfaceName -> String forall a b. (a -> b) -> a -> b $ String -> InterfaceName getWatcherInterfaceName (WatcherParams -> String watcherNamespace WatcherParams defaultWatcherParams) , genObjectPath :: Maybe ObjectPath genObjectPath = ObjectPath -> Maybe ObjectPath forall a. a -> Maybe a Just (ObjectPath -> Maybe ObjectPath) -> ObjectPath -> Maybe ObjectPath forall a b. (a -> b) -> a -> b $ String -> ObjectPath forall a. IsString a => String -> a fromString (String -> ObjectPath) -> String -> ObjectPath forall a b. (a -> b) -> a -> b $ WatcherParams -> String watcherPath WatcherParams defaultWatcherParams , genTakeSignalErrorHandler :: Bool genTakeSignalErrorHandler = Bool True }