如何将这两个配置部分连接在一起?

How to join those two config parts together?

在我的 xmonad 配置中,我有以下内容:

main = do 
  xmproc <- spawnPipe "xmobar -x 0 ~.config/xmobar/xmobar.config"
  xmonad $ docks defaults

但是chrome有问题,我需要补充一下:

import XMonad
import XMonad.Hooks.EwmhDesktops

main = xmonad $ ewmh def{ handleEventHook =
           handleEventHook def <+> fullscreenEventHook }

我不确定如何将这两者结合起来。所以要保留 xmobar 配置、码头默认值和 ewmh

我试过了

main = do 
  xmproc <- spawnPipe "xmobar -x 0 ~.config/xmobar/xmobar.config"
  xmonad $ ewmh def{ handleEventHook =
           handleEventHook def <+> fullscreenEventHook }

但我也需要添加扩展坞。

更新:

感谢夏丽瑶的建议。 我试过这个:

  xmproc <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobar.config"
  xmonad $ docks defaults $ ewmh def{ handleEventHook =
     handleEventHook def <+> fullscreenEventHook }

但是这给出了错误

XMonad will use ghc to recompile, because "/home/adam/.xmonad/build" does not exist.
Error detected while loading xmonad configuration file: /home/adam/.xmonad/xmonad.hs

xmonad.hs:273:12: error:
    • Couldn't match expected type ‘XConfig
                                      (Choose Tall (Choose (Mirror Tall) Full))
                                    -> XConfig l0’
                  with actual type ‘XConfig
                                      (XMonad.Layout.LayoutModifier.ModifiedLayout
                                         AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)))’
    • The first argument of ($) takes one argument,
      but its type ‘XConfig
                      (XMonad.Layout.LayoutModifier.ModifiedLayout
                         AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)))’
      has none
      In the second argument of ‘($)’, namely
        ‘docks defaults
           $ ewmh
               def
                 {handleEventHook = handleEventHook def <+> fullscreenEventHook}’
      In a stmt of a 'do' block:
        xmonad
          $ docks defaults
              $ ewmh
                  def {handleEventHook = handleEventHook def <+> fullscreenEventHook}
    |
273 |   xmonad $ docks defaults $ ewmh def{ handleEventHook =
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

Please check the file for errors.

xmonad: xmessage: executeFile: does not exist (No such file or directory)

请注意 docksewmh 都采用配置

docks :: XConfig a -> XConfig a
ewmh  :: XConfig a -> XConfig a

它们是可以组合的函数

  xmonad $ docks $ ewmh def{ handleEventHook =
           handleEventHook def <+> fullscreenEventHook }

您似乎还有一个自定义配置 defaults :: XConfig a,您可以使用它代替 def(这是 XMonad 本身提供的默认配置)

  xmonad $ docks $ ewmh defaults{ handleEventHook =
           handleEventHook defaults <+> fullscreenEventHook }

  -- note there are two occurrences of "defaults" here (you definitely want the first one, and the second one matters if defaults and def have different definitions of handleEventHook)