I am configuring my xmonad file to send the Stdout to a SpawnPipe per the documentation at https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Hooks-DynamicLog.html#v:ppOutput
Here is the code that I have so far... I am sure I am just missing a way to pass h along to the myLogHook function! - Thanks for your help.
myLogHook = dynamicLogWithPP $ def { ppOutput = hPutStrLn h }
main = do
h <- spawnPipe "xmobar ~/.xmobar/.xmobarrc"
xmonad $ docks defaults
defaults = def {
-- simple stuff
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
clickJustFocuses = myClickJustFocuses,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- key bindings
keys = myKeys,
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = myLayout,
manageHook = myManageHook,
handleEventHook = myEventHook,
logHook = myLogHook,
startupHook = myStartupHook
}
First, change myLogHook
to take the handle as a parameter:
import System.IO
import XMonad
myLogHook :: Handle -> X ()
myLogHook h = dynamicLogWithPP $ def { ppOutput = hPutStrLn h }
Then, pass it to the hook and get rid of it from the defaults:
main = do
h <- spawnPipe "xmobar ~/.xmobar/.xmobarrc"
xmonad $ docks $ defaults {
logHook = myLogHook h
}
defaults = def {
-- some stuff
logHook = return ()
-- more stuff
}
The {}
after the defaults basically overwrites properties.