Commits

Max Rabkin  committed 6159589

Added capabilities

  • Participants
  • Parent commits b5c13a9

Comments (0)

Files changed (1)

File DBus/Notify.hs

     , Hint (..)
     -- * Handles to displayed notifications
     , Notification
+    -- * Capabilities
+    , getCapabilities
+    , Capability (..)
     ) where
 
 import DBus.Message
     Notification . fromJust . fromVariant . head . methodReturnBody <$>
         callBlocking cl proxy (mkMemberName' "Notify") [] (notifyArgs note replaceId)
 
+data Capability =   ActionsCap | BodyCap | BodyHyperlinksCap | BodyImagesCap
+                  | BodyMarkupCap | IconMultiCap | IconStaticCap | SoundCap
+                  | UnknownCap String
+    deriving (Eq, Read, Show)
+
+-- |Determine the server's capabilities
+getCapabilities :: Client -> IO [Capability]
+getCapabilities cl = map readCapability . fromJust . fromArray . fromJust
+                    . fromVariant . head . methodReturnBody
+                    <$> callBlocking cl proxy (mkMemberName' "GetCapabilities") [] []
+
 timeoutInt :: Timeout -> Int32
 timeoutInt Never = 0
 timeoutInt Dependent = -1
         hint (X x) = ("x", toVariant x)
         hint (Y y) = ("x", toVariant y)
 
--- HACK: Assumes the constructor for category foo.bar.baz is FooBarBaz and
+-- HACK: Assumes the constructor for category foo.bar is FooBar and
 -- categories have no capital letters
 catName :: Category -> String
 catName c = catName' (show c)