mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 12:41:52 -07:00
Add experimental xmonadPropLog function
This commit is contained in:
@@ -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
|
||||
--
|
||||
|
Reference in New Issue
Block a user