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,
|
dynamicLog,
|
||||||
dynamicLogXinerama,
|
dynamicLogXinerama,
|
||||||
|
|
||||||
|
xmonadPropLog',
|
||||||
xmonadPropLog,
|
xmonadPropLog,
|
||||||
|
|
||||||
-- * Build your own formatter
|
-- * Build your own formatter
|
||||||
@ -209,20 +210,24 @@ statusBar cmd pp k conf = do
|
|||||||
where
|
where
|
||||||
keys' = (`M.singleton` sendMessage ToggleStruts) . k
|
keys' = (`M.singleton` sendMessage ToggleStruts) . k
|
||||||
|
|
||||||
-- | Write a string to the property _XMONAD_LOG on the root window. This
|
-- | Write a string to a property on the root window. This property is of
|
||||||
-- property is of type UTF8_STRING. The string must have been processed by
|
-- type UTF8_STRING. The string must have been processed by encodeString
|
||||||
-- encodeString (dynamicLogString does this).
|
-- (dynamicLogString does this).
|
||||||
xmonadPropLog :: String -> X ()
|
xmonadPropLog' :: String -> String -> X ()
|
||||||
xmonadPropLog msg = do
|
xmonadPropLog' prop msg = do
|
||||||
d <- asks display
|
d <- asks display
|
||||||
r <- asks theRoot
|
r <- asks theRoot
|
||||||
xlog <- getAtom "_XMONAD_LOG"
|
xlog <- getAtom prop
|
||||||
ustring <- getAtom "UTF8_STRING"
|
ustring <- getAtom "UTF8_STRING"
|
||||||
io $ changeProperty8 d r xlog ustring propModeReplace (encodeCChar msg)
|
io $ changeProperty8 d r xlog ustring propModeReplace (encodeCChar msg)
|
||||||
where
|
where
|
||||||
encodeCChar :: String -> [CChar]
|
encodeCChar :: String -> [CChar]
|
||||||
encodeCChar = map (fromIntegral . ord)
|
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
|
-- Helper function which provides ToggleStruts keybinding
|
||||||
--
|
--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user