mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.H.DynamicLog: let the user of xmonadPropLog choose property name
This commit is contained in:
parent
520b9ccf6e
commit
21526d1532
@ -29,6 +29,7 @@ module XMonad.Hooks.DynamicLog (
|
||||
dynamicLog,
|
||||
dynamicLogXinerama,
|
||||
|
||||
xmonadPropLog',
|
||||
xmonadPropLog,
|
||||
|
||||
-- * Build your own formatter
|
||||
@ -209,20 +210,24 @@ 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. The string must have been processed by
|
||||
-- encodeString (dynamicLogString does this).
|
||||
xmonadPropLog :: String -> X ()
|
||||
xmonadPropLog msg = do
|
||||
-- | Write a string to a property on the root window. This property is of
|
||||
-- type UTF8_STRING. The string must have been processed by encodeString
|
||||
-- (dynamicLogString does this).
|
||||
xmonadPropLog' :: String -> String -> X ()
|
||||
xmonadPropLog' prop msg = do
|
||||
d <- asks display
|
||||
r <- asks theRoot
|
||||
xlog <- getAtom "_XMONAD_LOG"
|
||||
xlog <- getAtom prop
|
||||
ustring <- getAtom "UTF8_STRING"
|
||||
io $ changeProperty8 d r xlog ustring propModeReplace (encodeCChar msg)
|
||||
where
|
||||
encodeCChar :: String -> [CChar]
|
||||
encodeCChar = map (fromIntegral . ord)
|
||||
|
||||
-- | Write a string to the _XMONAD_LOG property on the root window.
|
||||
xmonadPropLog :: String -> X ()
|
||||
xmonadPropLog = xmonadPropLog' "_XMONAD_LOG"
|
||||
|
||||
-- |
|
||||
-- Helper function which provides ToggleStruts keybinding
|
||||
--
|
||||
|
Loading…
x
Reference in New Issue
Block a user