Home > Software engineering >  Xmonad warning and error for docksEventHook following last update
Xmonad warning and error for docksEventHook following last update

Time:07-10

I am running xmonad on Arch. I just updated to 0.17.0-1

I have this in my xmonad.hs file:

108   xmonad $ ewmh $ myConfig
109     { --These three line fix xmobar getting overlapped. Need all three in this order
110       manageHook      = manageDocks < > manageHook def
111     , layoutHook      = spacing 5 $ avoidStruts $ layoutHook def
112     , handleEventHook = handleEventHook def < > docksEventHook
113     }

After the last xmonad update I am now getting this warning when I try to recompile xmonod:

xmonad.hs:112:49: warning: [-Wdeprecations]
    In the use of ‘docksEventHook’
    (imported from XMonad.Hooks.ManageDocks):
    Deprecated: "Use docks instead."
    |
112 |     , handleEventHook = handleEventHook def < > docksEventHook
    |                                                 ^^^^^^^^^^^^^^

Please correct them or silence using {-# OPTIONS_GHC -Wno-deprecations #-}.

```hs
I have tried following the recommendation and changed line 112 to:

```hs
112 |     , handleEventHook = handleEventHook def < > docks

But that just creates the following error:

xmonad.hs:112:49: error:
    • Couldn't match type ‘XConfig a0’ with ‘Event’
      Expected: Event -> X base-4.15.1.0:Data.Semigroup.Internal.All
        Actual: XConfig a0 -> XConfig a0
    • In the second argument of ‘(< >)’, namely ‘docks’
      In the ‘handleEventHook’ field of a record
      In the second argument of ‘($)’, namely
        ‘myConfig
           {manageHook = manageDocks < > manageHook def,
            layoutHook = spacing 5 $ avoidStruts $ layoutHook def,
            handleEventHook = handleEventHook def < > docks}’
    |
112 |     , handleEventHook = handleEventHook def < > docks
    |                                                 ^^^^^

Please check the file for errors.

I do not understand how to proceed. If docks is the replacement for docksEventHook then why would the type be wrong?

What is the actual fix for this? I would prefer to fix the warnings rather than silence them.

CodePudding user response:

docks is now a combinator that operates on the whole configuration object, not just a hook like docksEventHook was, so you use it the same way you do ewmh:

   xmonad $ ewmh . docks $ myConfig
     {
       manageHook      = manageDocks < > manageHook def
     , layoutHook      = spacing 5 $ avoidStruts $ layoutHook def
     }
  • Related