Skip to content

Commit

Permalink
Added support for the new DBus library namely dbus-0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
u-quark committed Jul 26, 2012
1 parent 1100898 commit 8948b2a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions xmonad.hs
@@ -1,10 +1,11 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings, PackageImports #-}


import XMonad import XMonad
import XMonad.Config.Gnome import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog import XMonad.Hooks.DynamicLog


import qualified DBus.Client.Simple as D import qualified "dbus" DBus as D

This comment has been minimized.

Copy link
@u-quark

u-quark Jul 26, 2012

Author Owner

No sure if using package imports is good practice, but this is needed in case both dbus and one of dbus-core or DBus packages coexist in one ghc installation.

import qualified "dbus" DBus.Client as D
import qualified Codec.Binary.UTF8.String as UTF8 import qualified Codec.Binary.UTF8.String as UTF8


main :: IO () main :: IO ()
Expand All @@ -30,15 +31,15 @@ prettyPrinter dbus = defaultPP
getWellKnownName :: D.Client -> IO () getWellKnownName :: D.Client -> IO ()
getWellKnownName dbus = do getWellKnownName dbus = do
D.requestName dbus (D.busName_ "org.xmonad.Log") D.requestName dbus (D.busName_ "org.xmonad.Log")
[D.AllowReplacement, D.ReplaceExisting, D.DoNotQueue] [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
return () return ()


dbusOutput :: D.Client -> String -> IO () dbusOutput :: D.Client -> String -> IO ()
dbusOutput dbus str = D.emit dbus dbusOutput dbus str = do
"/org/xmonad/Log" let signal = (D.signal "/org/xmonad/Log" "org.xmonad.Log" "Update") {
"org.xmonad.Log" D.signalBody = [D.toVariant ("<b>" ++ (UTF8.decodeString str) ++ "</b>")]
"Update" }
[D.toVariant ("<b>" ++ (UTF8.decodeString str) ++ "</b>")] D.emit dbus signal


pangoColor :: String -> String -> String pangoColor :: String -> String -> String
pangoColor fg = wrap left right pangoColor fg = wrap left right
Expand Down

0 comments on commit 8948b2a

Please sign in to comment.