diff options
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r-- | XMonad/Hooks/DynamicLog.hs | 19 |
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 -- |