aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Hooks
diff options
context:
space:
mode:
authorSpencer Janssen <spencerjanssen@gmail.com>2009-11-07 01:46:24 +0100
committerSpencer Janssen <spencerjanssen@gmail.com>2009-11-07 01:46:24 +0100
commit1291f5f01de5581e5bc86418b9e9819f337a572d (patch)
tree644981e4bd8694bc01aafce6d35ff8b733f10722 /XMonad/Hooks
parentd78dee0a4ca76e148a88b43be3493ddc35a85e25 (diff)
downloadXMonadContrib-1291f5f01de5581e5bc86418b9e9819f337a572d.tar.gz
XMonadContrib-1291f5f01de5581e5bc86418b9e9819f337a572d.tar.xz
XMonadContrib-1291f5f01de5581e5bc86418b9e9819f337a572d.zip
Add experimental xmonadPropLog function
Ignore-this: f09b2c11b16a3af993b63d1b39566120 darcs-hash:20091107004624-25a6b-7d6cd58f8b759867bb49df0ac9bfc1472b3f7423.gz
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r--XMonad/Hooks/DynamicLog.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/XMonad/Hooks/DynamicLog.hs b/XMonad/Hooks/DynamicLog.hs
index 321fe6a..e7baee5 100644
--- a/XMonad/Hooks/DynamicLog.hs
+++ b/XMonad/Hooks/DynamicLog.hs
@@ -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
--