title: Remove borders from windows of specific class
body: <p>I'm trying to write a layout modifier very similar that would allow me to remove borders based on class name property of the windows. The code is largely based on  <a href="https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Layout-NoBorders.html" rel="nofollow noreferrer">XMonad.Layout.NoBorders</a> with the exception of the logic executing in the X monad to allow filtering based on <a href="https://hackage.haskell.org/package/xmonad-0.13/docs/XMonad-ManageHook.html#v:className" rel="nofollow noreferrer">className</a>. The code I've got so far is:</p>
  
  <pre class="lang-hs prettyprint-override"><code>{-# LANGUAGE FlexibleInstances #-}
  {-# LANGUAGE MultiParamTypeClasses #-}
  {-# LANGUAGE UndecidableInstances #-}
  
  module  XMonad.Layout.ExcludeBorders  where
  
  import           Control.Monad
  import           Data.Monoid
  import           XMonad
  import           XMonad.Layout.LayoutModifier
  import           XMonad.StackSet hiding (filter)
  
  setBorders :: [Window] -&gt; Dimension -&gt; X ()
  setBorders ws bw =
    withDisplay $ \d -&gt; mapM_ (\w -&gt; io $ setWindowBorderWidth d w bw) ws
  
  data ExcludeBorders p a =
    ExcludeBorders p
                   [a]
    deriving (Eq, Read, Show)
  
  excludeBorders :: p -&gt; l a -&gt; ModifiedLayout (ExcludeBorders p) l a
  excludeBorders qs = ModifiedLayout (ExcludeBorders qs [])
  
  instance (Show p, Read (ExcludeBorders p Window), Excludes p) =&gt;
           LayoutModifier (ExcludeBorders p) Window where
    unhook (ExcludeBorders _p s) = asks (borderWidth . config) &gt;&gt;= setBorders s
    redoLayout (ExcludeBorders p _s) _ mst wrs = do
      ws &lt;- withWindowSet (\wset -&gt; excludes p wset mst wrs)
      setBorders ws 0
      return (wrs, Just $ ExcludeBorders p ws)
  
  class Excludes p where
    excludes ::
         p
      -&gt; WindowSet
      -&gt; Maybe (Stack Window)
      -&gt; [(Window, Rectangle)]
      -&gt; X [Window]
  
  data ExcludeProp =
    ExcludeClassName String
    deriving (Eq, Read, Show)
  
  instance Excludes [ExcludeProp] where
    excludes qs _wset mst _wrs =
      flip filterM (integrate' mst) $ \w -&gt;
        fmap (getAny . mconcat) .
        sequenceA . map (fmap Any . flip runQuery w . toQuery) $
        qs
  
  toQuery :: ExcludeProp -&gt; Query Bool
  toQuery (ExcludeClassName s) = className =? s
  </code></pre>
  
  <p>which can be used in the layout hook as follows:</p>
  
  <pre class="lang-hs prettyprint-override"><code>excludeBorders [ExcludeClassName "Krunner", ExcludeClassName "plasmashell"]
  </code></pre>
  
  <p>Unfortunately as is it doesn't have the desired effect, or any effect at all.. Being completely new to writing layout modifiers I'm not sure what I'm doing wrong, and perhaps I misunderstand how the <code>redoLayout</code> function is supposed to work. Any pointers would be appreciated.</p>
  
  <hr />
  
  <p><strong>EDIT</strong>: Some further testing shows this may be a peculiarity of KDE / plasma windows and / or issue with my config rather that anything to do with my code.</p>