Add experimental xmonadPropLog function

This commit is contained in:
Spencer Janssen
2009-11-07 00:46:24 +00:00
parent 2edac2fc13
commit 3f6787be4f

View File

@@ -29,6 +29,8 @@ module XMonad.Hooks.DynamicLog (
dynamicLog,
dynamicLogXinerama,
xmonadPropLog,
-- * Build your own formatter
dynamicLogWithPP,
dynamicLogString,
@@ -63,6 +65,10 @@ import qualified Data.Map as M
import Data.Ord ( comparing )
import qualified XMonad.StackSet as S
import System.IO
import qualified Codec.Binary.UTF8.String as UTF8
import Foreign.C (CChar)
import XMonad.Util.WorkspaceCompare
import XMonad.Util.NamedWindows
import XMonad.Util.Run
@@ -198,6 +204,19 @@ statusBar cmd pp k conf = do
where
keys' = (`M.singleton` sendMessage ToggleStruts) . k
-- | Write a string to the property _XMONAD_LOG on the root window. This
-- property is of type UTF8_STRING.
xmonadPropLog :: String -> X ()
xmonadPropLog msg = do
d <- asks display
r <- asks theRoot
xlog <- getAtom "_XMONAD_LOG"
ustring <- getAtom "UTF8_STRING"
io $ changeProperty8 d r xlog ustring propModeReplace (encodeCChar msg)
where
encodeCChar :: String -> [CChar]
encodeCChar = map fromIntegral . UTF8.encode
-- |
-- Helper function which provides ToggleStruts keybinding
--