The closest thing is probably logHook :: !(X ())
in the XConfig
. You can get the focused window and run your IO
action to update the environment, but this hook is described as "The action to perform when the window set is changed", so your updateEnv
could be called multiple times in a row with the same window ID (when you swap windows without changing focus, for example).
myLogHook = gets (peek . windowset) >>= liftIO . updateEnv
where
updateEnv :: Maybe Window -> IO ()
updateEnv = undefined