diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,10 @@
+## Version 0.46 (January, 2023)
+
+- New bar position specifiers TopHM, BottomHM.
+- New configuration option, `dpi`, to set the font scaling factor.
+- Fixes and extensions for section aligment behaviour (#650, #655).
+- Fix: honour fc/bg specs for icons (#663).
+
 ## Version 0.45 (October, 2022)
 
 - New cairo/pango font drawing backend, substituting the direct X11/Xft one.
diff --git a/doc/compiling.org b/doc/compiling.org
--- a/doc/compiling.org
+++ b/doc/compiling.org
@@ -85,7 +85,9 @@
      enters a high-CPU regime right after starting.
 
    - =with_xrender= Enables the main bar background alpha parameter.  Requires
-     the [[http://hackage.haskell.org/package/X11-xft/][X11-xft]] package.
+     the [[http://hackage.haskell.org/package/X11-xft/][X11-xft]] package.  The Xrender extension is not compatible with 10-bit
+     colour modes, i.e., setting ~DefaultDepth~ to 30 in your Xorg
+     configuration.  See discussion in [[https://codeberg.org/xmobar/xmobar/issues/651][issue 651]] for details.
 
    - =with_xpm= Support for xpm image file format. This will allow loading
      .xpm files in =<icon>=. Requires the [[http://cgit.freedesktop.org/xorg/lib/libXpm][libXpm]] C library.
diff --git a/doc/quick-start.org b/doc/quick-start.org
--- a/doc/quick-start.org
+++ b/doc/quick-start.org
@@ -6,7 +6,7 @@
 configuration language, see [[../etc/xmobar.config][etc/xmobar.config]], and you can have a look at
 [[../etc/xmobar.hs][etc/xmobar.hs]] for an example of how to write your own xmobar using Haskell.
 
-* Command Line Options
+* Command line options
 
   xmobar can be either configured with a configuration file or with
   command line options. In the second case, the command line options will
@@ -48,11 +48,12 @@
     -x screen     --screen=screen        On which X screen number to start
     -p position   --position=position    Specify position of xmobar. Same syntax as in config file
     -T [format]   --text[=format]        Write output to stdout
+    -D dpi        --dpi=dpi              The DPI scaling factor. Default 96.0
 
      Mail bug reports and suggestions to <mail@jao.io>
   #+end_example
 
-* Configuration Options
+* Configuration options
   :PROPERTIES:
   :CUSTOM_ID: configuration-options
   :END:
@@ -77,6 +78,11 @@
         additionalFonts = [iconFont, altIconFont]
       #+end_src
 
+    - =dpi= The DPI scaling factor, as a decimal, to use. If 0, negative, or not
+      given, the default of 96 will be used, which corresponds to an average
+      screen. A 10pt font will therefore scale to 10pt * (1/72 pt/inch) * (96
+      pixel/inch) = 13.3 pixel. This is especially useful for HiDPI displays.
+
     The global font is used by default when none of the others is specified
     using the ~<fn=n>...</fn>~ markup, with ~n~ a 1-based index in the
     ~additionalFonts~ array.  So, for instance
@@ -192,7 +198,7 @@
 
 *** Bar position
 
-    - =position= Top, TopH, TopP, TopW, TopSize, Bottom, BottomH,
+    - =position= Top, TopH, TopHM, TopP, TopW, TopSize, Bottom, BottomH, BottomHM,
       BottomP, BottomW, BottomSize or Static (with x, y, width and height).
 
       TopP and BottomP take 2 arguments: left padding and right padding.
@@ -219,9 +225,20 @@
         position = BottomH 30
       #+end_src
 
-      to make a 30 tall bar on the bottom of the screen.
+      to make a 30 tall bar on the bottom of the screen.  The corresponding
+      variants ~TopHM~ and ~BottomHM~ allow you to specify, in addition to a
+      height, margins (in pixels) with the borders of the screen (left, right
+      top and bottom); so they take five integers as arguments.  For instance,
+      if you one a margin of 2 pixels to the left of the top bar in the above
+      example and 4 to its right and top, you could use:
 
       #+begin_src haskell
+        position = TopHM 30 2 4 4 0
+      #+end_src
+
+      and similarly for ~BottomHM~.
+
+      #+begin_src haskell
         position = BottomW C 75
       #+end_src
 
@@ -290,15 +307,13 @@
     - =commands= The list of monitors and plugins to run, together with their
       individual configurations. The [[./plugins.org][plugin documentation]] details all the
       available monitors, and you can also create new ones using Haskell.  See
-      [[#commands-list][The commands list]] section below for more.
+      the [[#commands-list][commands list section]] below for more.
 
     - =sepChar= The character to be used for indicating commands in the
-      output template (default '%').
+      output template (defaults to '%').
 
-    - =alignSep= a 2 character string for aligning text in the output
-      template. The text before the first character will be align to left,
-      the text in between the 2 characters will be centered, and the text
-      after the second character will be align to the right.
+    - =alignSep= a 2-character string for aligning text in the output
+      template. See [[#bar-sections][this section]] for details.
 
     - =template= The output template: a string telling xmobar how to display the
       outputs of all the =commands= above.  See [[#output-template][the next section]] for a full
@@ -381,7 +396,8 @@
       opacity, with two additional hex digits (e.g. #FF00000aa).
 
     - =<fn=1>string</fn>= will print =string= with the first font from
-      =additionalFonts=. The index =0= corresponds to the standard font.
+      =additionalFonts=. The index =0= corresponds to the standard font.  The
+      standard font is also used if the index is out of bounds.
 
     - =<hspace=X/>= will insert a blank horizontal space of =X= pixels.
       For example, to add a blank horizontal space of 123 pixels,
@@ -423,6 +439,36 @@
       See the subsections below for more information on ~<box/>~,
       ~<icon/>~ and ~<action/>~.
 
+    - The special characters =}= and ={= are used to delimit up to three sections
+      in the bar that are drawn and aligned independently. See [[#bar-sections][this section]]
+      for more.
+
+*** Bar sections
+    :PROPERTIES:
+    :CUSTOM_ID: bar-sections
+    :END:
+
+     You can use the special characters =}= and ={= are used to delimit up to three
+     sections in the bar, which are aligned and, if needed, overlapped
+     according to these rules:
+
+     - If the template has the form =L}M{R=, with L, R, M arbitrary specs, the
+       monitors in =L= are drawn first, aligned to the left, then =R=, aligned to
+       the right, and finally =M= is drawn centered in the bar. =R= is trimmed to
+       the space left by =L=, and =M= is trimmed to the space left by =L= and =R=.
+
+     - If the template has the form =L}{R=, =L= is drawn aligned to the left first
+       and then =R=, aligned to the right and trimmed if needed to fit in the
+       space left by =L=.
+
+     - If the template has the form =}L{R=, =R= is drawn first, aligned to the
+       right, and then =L=, aligned to the left and trimmed to the space left by
+       =R=.
+
+     When needed, sections are always trimmed on the right.  The section
+     delimiters can be changed using the configuration option =alignSep,= a
+     two-character string.
+
 *** Boxes around text
 
     - =<box>string</box>= will print string surrounded by a box in the
@@ -483,7 +529,7 @@
 
     Icons are ignored when xmobar is run in text output mode.
 
-*** Using the mouse: Action directives
+*** Mouse actions
 
     It's also possible to use action directives of the form:
 
@@ -583,7 +629,7 @@
 
    - After receiving ~SIGUSR2~ xmobar repositions itself on the current
      screen.
-* The DBus Interface
+* The DBus interface
 
   When compiled with the optional =with_dbus= flag, xmobar can be controlled
   over dbus. All signals defined in [[../src/Xmobar/System/Signal.hs][src/Signal.hs]] as =data SignalType= can now
diff --git a/doc/using-haskell.org b/doc/using-haskell.org
--- a/doc/using-haskell.org
+++ b/doc/using-haskell.org
@@ -26,7 +26,7 @@
     config :: Config
     config =
       defaultConfig
-        { font = "xft:Terminus-8",
+        { font = "DejaVu Sans Mono 9",
           allDesktops = True,
           alpha = 200,
           commands =
@@ -40,7 +40,7 @@
         }
 
     main :: IO ()
-    main = xmobar config
+    main = xmobar config  -- or: configFromArgs config >>= xmobar
   #+end_src
 
   You can then for instance run =ghc --make xmobar.hs= to create a new xmobar
diff --git a/readme.org b/readme.org
--- a/readme.org
+++ b/readme.org
@@ -117,7 +117,7 @@
    or =~/.xmobarrc=.
 
    All the available command line switches and configuration parameters are
-   described in [[file:quick-start.org][the quick start guide]] and [[file:doc/plugins.org][the plugins index]].
+   described in [[file:doc/quick-start.org][the quick start guide]] and [[file:doc/plugins.org][the plugins index]].
 
 ** Writing your own xmobar in Haskell
 
@@ -156,36 +156,34 @@
 
 * Authors and credits
 
-  Andrea Rossato originally designed and implemented xmobar up to
-  version 0.11.1. Since then, it is maintained and developed by [[https://jao.io][jao]],
-  with the help of the greater xmobar and Haskell communities.
+  Andrea Rossato originally designed and implemented xmobar up to version
+  0.11.1. Since then, it is maintained and developed by [[https://jao.io][jao]], with the help of
+  the greater xmobar and Haskell communities.
 
-  In particular, xmobar incorporates patches by Mohammed Alshiekh,
-  Alex Ameen, Axel Angel, Dhananjay Balan, Claudio Bley, Dragos Boca,
-  Ben Boeckel, Ivan Brennan, Duncan Burke, Roman Cheplyaka, Patrick
-  Chilton, Antoine Eiche, Nathaniel Wesley Filardo, Guy Gastineau,
-  John Goerzen, Patrick Günther, Reto Hablützel, Juraj Hercek, Tomáš
-  Janoušek, Ada Joule, Spencer Janssen, Roman Joost, Pavel Kalugin,
-  Jochen Keil, Sam Kirby, Lennart Kolmodin, Krzysztof Kosciuszkiewicz,
-  Dmitry Kurochkin, Todd Lunter, Vanessa McHale, Robert J. Macomber,
-  Dmitry Malikov, David McLean, Joan Milev, Marcin Mikołajczyk, Dino
-  Morelli, Tony Morris, Eric Mrak, Thiago Negri, Edward O'Callaghan,
-  Svein Ove, Martin Perner, Jens Petersen, Alexander Polakov, Sibi
-  Prabakaran, Pavan Rikhi, Petr Rockai, Andrew Emmanuel Rosa,
-  Sackville-West, Amir Saeid, Markus Scherer, Daniel Schüssler,
-  Olivier Schneider, Alexander Shabalin, Valentin Shirokov, Peter
-  Simons, Alexander Solovyov, Will Song, John Soo, John Soros, Felix
-  Springer, Travis Staton, Artem Tarasov, Samuli Thomasson, Edward
-  Tjörnhammar, Sergei Trofimovich, Thomas Tuegel, John Tyree, Jan
-  Vornberger, Anton Vorontsov, Daniel Wagner, Zev Weiss, Phil Xiaojun
-  Hu, Nikolay Yakimov, Edward Z. Yang, Leo Zhang, Norbert Zeh, and
-  Michał Zielonka.
+  In particular, xmobar incorporates patches by Kostas Agnantis, Mohammed
+  Alshiekh, Alex Ameen, Axel Angel, Dhananjay Balan, Claudio Bley, Dragos
+  Boca, Ben Boeckel, Ivan Brennan, Duncan Burke, Roman Cheplyaka, Patrick
+  Chilton, Antoine Eiche, Nathaniel Wesley Filardo, Guy Gastineau, John
+  Goerzen, Jonathan Grochowski, Patrick Günther, Reto Hablützel, Juraj Hercek,
+  Tomáš Janoušek, Ada Joule, Spencer Janssen, Roman Joost, Pavel Kalugin,
+  Jochen Keil, Sam Kirby, Lennart Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry
+  Kurochkin, Todd Lunter, Vanessa McHale, Robert J. Macomber, Dmitry Malikov,
+  David McLean, Joan Milev, Marcin Mikołajczyk, Dino Morelli, Tony Morris,
+  Eric Mrak, Thiago Negri, Edward O'Callaghan, Svein Ove, Martin Perner, Jens
+  Petersen, Alexander Polakov, Sibi Prabakaran, Pavan Rikhi, Petr Rockai,
+  Andrew Emmanuel Rosa, Sackville-West, Amir Saeid, Markus Scherer, Daniel
+  Schüssler, Olivier Schneider, Alexander Shabalin, Valentin Shirokov, Peter
+  Simons, Alexander Solovyov, Will Song, John Soo, John Soros, Felix Springer,
+  Travis Staton, Artem Tarasov, Samuli Thomasson, Edward Tjörnhammar, Sergei
+  Trofimovich, Thomas Tuegel, John Tyree, Jan Vornberger, Anton Vorontsov,
+  Daniel Wagner, Zev Weiss, Phil Xiaojun Hu, Nikolay Yakimov, Edward Z. Yang,
+  Leo Zhang, Norbert Zeh, and Michał Zielonka.
 
-  Andrea wants to thank Robert Manea and Spencer Janssen for their
-  help in understanding how X works. They gave him suggestions on how
-  to solve many problems with xmobar.  He also thanks Claus Reinke for
-  making him understand existential types (or at least for letting him
-  think he grasps existential types...;-).
+  Andrea wants to thank Robert Manea and Spencer Janssen for their help in
+  understanding how X works. They gave him suggestions on how to solve many
+  problems with xmobar.  He also thanks Claus Reinke for making him understand
+  existential types (or at least for letting him think he grasps existential
+  types...;-).
 
 * License
 
diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs
--- a/src/Xmobar/App/Config.hs
+++ b/src/Xmobar/App/Config.hs
@@ -67,6 +67,7 @@
            , signal = SignalChan Nothing
            , textOutput = False
            , textOutputFormat = Plain
+           , dpi = 96.0
            }
 
 -- | Return the path to the xmobar data directory.  This directory is
diff --git a/src/Xmobar/App/Opts.hs b/src/Xmobar/App/Opts.hs
--- a/src/Xmobar/App/Opts.hs
+++ b/src/Xmobar/App/Opts.hs
@@ -52,6 +52,7 @@
           | Position String
           | WmClass String
           | WmName String
+          | Dpi String
        deriving (Show, Eq)
 
 options :: [OptDescr Opts]
@@ -95,6 +96,8 @@
       "On which X screen number to start"
     , Option "p" ["position"] (ReqArg Position "position")
       "Specify position of xmobar. Same syntax as in config file"
+    , Option "D" ["dpi"] (ReqArg Dpi "dpi")
+      "The DPI scaling factor. Default 96.0"
     ]
 
 getOpts :: [String] -> IO ([Opts], [String])
@@ -161,6 +164,7 @@
                       Right x -> doOpts' (conf {commands = commands conf ++ x})
                       Left e -> putStr (e ++ usage) >> exitWith (ExitFailure 1)
     Position s -> readPosition s
+    Dpi d -> doOpts' (conf {dpi = read d})
   where readCom c str =
           case readStr str of
             [x] -> Right x
diff --git a/src/Xmobar/Config/Parse.hs b/src/Xmobar/Config/Parse.hs
--- a/src/Xmobar/Config/Parse.hs
+++ b/src/Xmobar/Config/Parse.hs
@@ -72,7 +72,7 @@
               <|?> pAllDesktops <|?> pOverrideRedirect <|?> pPickBroadest
               <|?> pLowerOnStart <|?> pPersistent <|?> pIconRoot
               <|?> pCommands <|?> pSepChar <|?> pAlignSep <|?> pTemplate
-              <|?> pVerbose <|?> pSignal
+              <|?> pVerbose <|?> pSignal <|?> pDpi
 
       fields    = [ "font", "additionalFonts", "bgColor", "fgColor"
                   , "wmClass", "wmName", "sepChar"
@@ -81,7 +81,7 @@
                   , "allDesktops", "overrideRedirect", "pickBroadest"
                   , "hideOnStart", "lowerOnStart", "persistent", "iconRoot"
                   , "alpha", "commands", "verbose", "signal", "textOutput"
-                  , "textOutputFormat"
+                  , "textOutputFormat", "dpi"
                   ]
 
       pTextOutput = readField textOutput "textOutput"
@@ -112,6 +112,7 @@
       pIconRoot = readField iconRoot "iconRoot"
       pAlpha = readField alpha "alpha"
       pVerbose = readField verbose "verbose"
+      pDpi = readField dpi "dpi"
 
       pSignal = field signal "signal" $
         fail "signal is meant for use with Xmobar as a library.\n It is not meant for use in the configuration file."
diff --git a/src/Xmobar/Config/Types.hs b/src/Xmobar/Config/Types.hs
--- a/src/Xmobar/Config/Types.hs
+++ b/src/Xmobar/Config/Types.hs
@@ -85,20 +85,94 @@
            , template :: String     -- ^ The output template
            , verbose :: Bool        -- ^ Emit additional debug messages
            , signal :: SignalChan   -- ^ Channel to send signals to xmobar
+           , dpi :: Double          -- ^ DPI scaling factor for fonts
            } deriving (Read, Show)
 
-data XPosition = Top
-               | TopH Int
-               | TopW Align Int
-               | TopSize Align Int Int
-               | TopP Int Int
+-- | The position datatype
+data XPosition = Top            -- ^ Top of the screen, full width, auto height
+
+               | TopH           -- ^ Top of the screen, full width with
+                                --   specific height
+                  Int           -- ^ Height (in pixels)
+
+                 -- | Top of the screen, full width with
+                 --   specific height and margins
+               | TopHM
+                  Int           -- ^ Height (in pixels)
+                  Int           -- ^ Left margin (in pixels)
+                  Int           -- ^ Right margin (in pixels)
+                  Int           -- ^ Top margin (in pixels)
+                  Int           -- ^ Bottom margin (in pixels)
+
+                 -- | Top of the screen with specific width
+                 --   (as screen percentage) and alignment
+               | TopW
+                  Align         -- ^ Alignement (L|C|R)
+                  Int           -- ^ Width as screen percentage (0-100)
+
+                 -- | Top of the screen with specific width
+                 --   (as screen percentage), height and
+                 --   alignment
+               | TopSize
+                  Align         -- ^ Alignement (L|C|R)
+                  Int           -- ^ Width as screen percentage (0-100)
+                  Int           -- ^ Height (in pixels)
+
+                 -- | Top of the screen with specific left/right
+                 --   margins
+               | TopP
+                  Int           -- ^ Left margin (in pixels)
+                  Int           -- ^ Right margin (in pixels)
+
+                 -- | Bottom of the screen, full width, auto height
                | Bottom
-               | BottomH Int
-               | BottomP Int Int
-               | BottomW Align Int
-               | BottomSize Align Int Int
-               | Static {xpos, ypos, width, height :: Int}
-               | OnScreen Int XPosition
+
+               | BottomH        -- ^ Bottom of the screen, full width, with
+                                --   specific height
+                  Int           -- ^ Height (in pixels)
+
+                 -- | Bottom of the screen with specific height
+                 --   and margins
+               | BottomHM
+                  Int           -- ^ Height (in pixels)
+                  Int           -- ^ Left margin (in pixels)
+                  Int           -- ^ Right margin (in pixels)
+                  Int           -- ^ Top margin (in pixels)
+                  Int           -- ^ Bottom margin (in pixels)
+
+                 -- | Bottom of the screen with specific
+                 --   left/right margins
+               | BottomP
+                  Int           -- ^ Left margin (in pixels)
+                  Int           -- ^ Bottom margin (in pixels)
+
+                 -- | Bottom of the screen with specific width
+                 --   (as screen percentage) and alignment
+                 --   and alignment
+               | BottomW
+                  Align         -- ^ Alignement (L|C|R)
+                  Int           -- ^ Width as screen percentage (0-100)
+
+                 -- | Bottom of the screen with specific width
+                 --   (as screen percentage), height
+                 --   and alignment
+               | BottomSize
+                  Align         -- ^ Alignement (L|C|R)
+                  Int           -- ^ Width as screen percentage (0-100)
+                  Int           -- ^ Height (in pixels)
+
+                 -- | Static position and specific size
+               | Static { xpos :: Int   -- ^ Position X (in pixels)
+                        , ypos :: Int   -- ^ Position Y (in pixels)
+                        , width :: Int  -- ^ Width (in pixels)
+                        , height :: Int -- ^ Height (in pixels)
+                        }
+
+                 -- | Along with the position characteristics
+                 --   specify the screen to display the bar
+               | OnScreen
+                  Int           -- ^ Screen id (primary is 0)
+                  XPosition     -- ^ Position
                  deriving ( Read, Show, Eq )
 
 data Align = L | R | C deriving ( Read, Show, Eq )
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -92,11 +92,14 @@
 withRenderinfo _ _ seg@(C.Hspace w, _, _, _) =
   return (seg, \_ _ _ -> return (), fromIntegral w)
 
-withRenderinfo _ dctx seg@(C.Icon p, _, _, _) = do
+withRenderinfo _ dctx seg@(C.Icon p, info, _, _) = do
   let (wd, _) = T.dcIconLookup dctx p
       ioff = C.iconOffset (T.dcConfig dctx)
       vpos = T.dcHeight dctx / 2  + fromIntegral ioff
-      render _ off mx = when (off + wd <= mx) $ T.dcIconDrawer dctx off vpos p
+      conf = T.dcConfig dctx
+      (fg, bg) = ConfigParse.colorComponents conf (C.tColorsString info)
+      render _ off mx = when (off + wd <= mx) $
+        T.dcIconDrawer dctx off vpos p fg bg
   return (seg, render, wd)
 
 drawBox :: T.DrawContext -> Surface -> Double -> Double -> C.Box -> IO ()
@@ -124,8 +127,9 @@
       acts' = case a of Just as -> (as, off, end):acts; _ -> acts
       bs = C.tBoxes info
       boxs' = if null bs then boxs else (off, end, bs):boxs
-  drawSegmentBackground dctx surface info off end
-  render surface off maxoff
+  when (end > off) $ do
+    drawSegmentBackground dctx surface info off end
+    render surface off maxoff
   return (off + lwidth, acts', boxs')
 
 renderOuterBorder :: C.Config -> Double -> Double -> Cairo.Render ()
@@ -171,6 +175,7 @@
       conf = T.dcConfig dctx
       sWidth = foldl (\a (_,_,w) -> a + w) 0
   ctx <- Pango.cairoCreateContext Nothing
+  Pango.cairoContextSetResolution ctx $ C.dpi conf
   llyts <- mapM (withRenderinfo ctx dctx) left
   rlyts <- mapM (withRenderinfo ctx dctx) right
   clyts <- mapM (withRenderinfo ctx dctx) center
@@ -178,12 +183,12 @@
   drawCairoBackground dctx surf
 #endif
   (lend, as, bx) <- foldM (drawSegment dctx surf dw) (0, [], []) llyts
-  let rw = sWidth rlyts
-      rstart = max (lend + 1) (dw - rw - 1)
-      cmax = rstart - 1
-      cw = sWidth clyts
-      cstart = lend + 1 + max 0 (dw - rw - lend - cw) / 2.0
-  (_, as', bx') <- foldM (drawSegment dctx surf cmax) (cstart, as, bx) clyts
+  let [rw, cw] = map sWidth [rlyts, clyts]
+      rstart = max lend (dw - rw)
+      cstart = if lend > 1 then max lend ((dw - cw) / 2.0) else lend
+  (_, as', bx') <- if cw > 0
+                   then foldM (drawSegment dctx surf rstart) (cstart, as, bx) clyts
+                   else return (0, as, bx)
   (_, as'', bx'') <- foldM (drawSegment dctx surf dw) (rstart, as', bx') rlyts
   drawBoxes dctx surf (reverse bx'')
   when (C.borderWidth conf > 0) (drawBorder conf dw dh surf)
diff --git a/src/Xmobar/Draw/Types.hs b/src/Xmobar/Draw/Types.hs
--- a/src/Xmobar/Draw/Types.hs
+++ b/src/Xmobar/Draw/Types.hs
@@ -25,7 +25,7 @@
 type Actions = [ActionPos]
 
 type IconLookup = String -> (Double, Double)
-type IconDrawer = Double -> Double -> String -> IO ()
+type IconDrawer = Double -> Double -> String -> String -> String -> IO ()
 
 data DrawContext = DC { dcIconDrawer :: IconDrawer
                       , dcIconLookup :: IconLookup
diff --git a/src/Xmobar/Plugins/Kraken.hs b/src/Xmobar/Plugins/Kraken.hs
--- a/src/Xmobar/Plugins/Kraken.hs
+++ b/src/Xmobar/Plugins/Kraken.hs
@@ -36,7 +36,7 @@
            cb (display g)
            loop mv g
 
-      loop mvar (Map.fromList $ zip ps (repeat 0.0))
+      loop mvar (Map.fromList $ map (, 0.0) ps)
 
     where
       display :: Map.Map String Double -> String
diff --git a/src/Xmobar/Plugins/Monitors/Common/Output.hs b/src/Xmobar/Plugins/Monitors/Common/Output.hs
--- a/src/Xmobar/Plugins/Monitors/Common/Output.hs
+++ b/src/Xmobar/Plugins/Monitors/Common/Output.hs
@@ -140,7 +140,7 @@
 padString :: Int -> Int -> String -> Bool -> String -> String -> String
 padString mnw mxw pad pr ellipsis s =
   let len = length s
-      rmin = if mnw < 0 then 0 else mnw
+      rmin = max mnw 0
       rmax = if mxw <= 0 then max len rmin else mxw
       (rmn, rmx) = if rmin <= rmax then (rmin, rmax) else (rmax, rmin)
       rlen = min (max rmn len) rmx
diff --git a/src/Xmobar/X11/Draw.hs b/src/Xmobar/X11/Draw.hs
--- a/src/Xmobar/X11/Draw.hs
+++ b/src/Xmobar/X11/Draw.hs
@@ -37,11 +37,8 @@
 #endif
 
 drawXBitmap :: T.XConf -> X11.GC -> X11.Pixmap -> D.IconDrawer
-drawXBitmap xconf gc p h v path = do
+drawXBitmap xconf gc p h v path fc bc = do
   let disp = T.display xconf
-      conf = T.config xconf
-      fc = C.fgColor conf
-      bc = C.bgColor conf
   case M.lookup path (T.iconCache xconf) of
     Just bm -> liftIO $ B.drawBitmap disp p gc fc bc (round h) (round v) bm
     Nothing -> return ()
@@ -88,7 +85,7 @@
 #ifdef XRENDER
         color = C.bgColor conf
         alph = C.alpha conf
-    XRender.drawBackground disp p color alph (X11.Rectangle 0 0 w h)
+    XRender.drawBackground disp p color alph rect
 #endif
 
     CS.withXlibSurface disp p vis (fromIntegral w) (fromIntegral h) render
diff --git a/src/Xmobar/X11/Window.hs b/src/Xmobar/X11/Window.hs
--- a/src/Xmobar/X11/Window.hs
+++ b/src/Xmobar/X11/Window.hs
@@ -86,10 +86,14 @@
     T.Top -> X.Rectangle rx ry rw h
     T.TopP l r -> X.Rectangle (rx + fi l) ry (rw - fi l - fi r) h
     T.TopH ch -> X.Rectangle rx ry rw (mh ch)
+    T.TopHM ch l r t _ ->
+      X.Rectangle (rx + fi l) (ry + fi t) (rw - fi l - fi r) (mh ch)
     T.TopW a i -> X.Rectangle (ax a i) ry (nw i) h
     T.TopSize a i ch -> X.Rectangle (ax a i) ry (nw i) (mh ch)
     T.Bottom -> X.Rectangle rx ny rw h
     T.BottomH ch -> X.Rectangle rx (ny' ch) rw (mh ch)
+    T.BottomHM ch l r _ b ->
+      X.Rectangle (rx + fi l) (ry + fi rh - fi b - fi (mh ch)) (rw - fi l - fi r) (mh ch)
     T.BottomW a i -> X.Rectangle (ax a i) ny (nw i) h
     T.BottomP l r -> X.Rectangle (rx + fi l) ny (rw - fi l - fi r) h
     T.BottomSize a i ch  -> X.Rectangle (ax a i) (ny' ch) (nw i) (mh ch)
@@ -160,18 +164,20 @@
 getStrutValues :: X.Rectangle -> T.XPosition -> Int -> [Int]
 getStrutValues r@(X.Rectangle x y w h) p rwh =
   case p of
-    T.OnScreen _ p'   -> getStrutValues r p' rwh
-    T.Top             -> [0, 0, st,  0, 0, 0, 0, 0, nx, nw,  0,  0]
-    T.TopH    _       -> [0, 0, st,  0, 0, 0, 0, 0, nx, nw,  0,  0]
-    T.TopP    _ _     -> [0, 0, st,  0, 0, 0, 0, 0, nx, nw,  0,  0]
-    T.TopW    _ _     -> [0, 0, st,  0, 0, 0, 0, 0, nx, nw,  0,  0]
-    T.TopSize      {} -> [0, 0, st,  0, 0, 0, 0, 0, nx, nw,  0,  0]
-    T.Bottom          -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]
-    T.BottomH _       -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]
-    T.BottomP _ _     -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]
-    T.BottomW _ _     -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]
-    T.BottomSize   {} -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]
-    T.Static       {} -> getStaticStrutValues p rwh
+    T.OnScreen _ p'      -> getStrutValues r p' rwh
+    T.Top                -> [0, 0, st  , 0   , 0, 0, 0, 0, nx, nw, 0 , 0 ]
+    T.TopH    _          -> [0, 0, st  , 0   , 0, 0, 0, 0, nx, nw, 0 , 0 ]
+    T.TopHM _ _ _ _ b    -> [0, 0, st+b, 0   , 0, 0, 0, 0, nx, nw, 0 , 0 ]
+    T.TopP    _ _        -> [0, 0, st  , 0   , 0, 0, 0, 0, nx, nw, 0 , 0 ]
+    T.TopW    _ _        -> [0, 0, st  , 0   , 0, 0, 0, 0, nx, nw, 0 , 0 ]
+    T.TopSize      {}    -> [0, 0, st  , 0   , 0, 0, 0, 0, nx, nw, 0 , 0 ]
+    T.Bottom             -> [0, 0, 0   , sb  , 0, 0, 0, 0, 0 , 0 , nx, nw]
+    T.BottomH _          -> [0, 0, 0   , sb  , 0, 0, 0, 0, 0 , 0 , nx, nw]
+    T.BottomHM _ _ _ t _ -> [0, 0, 0   , sb+t, 0, 0, 0, 0, 0 , 0 , nx, nw]
+    T.BottomP _ _        -> [0, 0, 0   , sb  , 0, 0, 0, 0, 0 , 0 , nx, nw]
+    T.BottomW _ _        -> [0, 0, 0   , sb  , 0, 0, 0, 0, 0 , 0 , nx, nw]
+    T.BottomSize   {}    -> [0, 0, 0   , sb  , 0, 0, 0, 0, 0 , 0 , nx, nw]
+    T.Static       {}    -> getStaticStrutValues p rwh
   where st = fi y + fi h
         sb = rwh - fi y
         nx = fi x
diff --git a/xmobar.cabal b/xmobar.cabal
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -1,5 +1,5 @@
 name:               xmobar
-version:            0.45
+version:            0.46
 homepage:           https://codeberg.org/xmobar/xmobar
 synopsis:           A Minimalistic Text Based Status Bar
 description: 	    Xmobar is a minimalistic text based status bar.
@@ -194,7 +194,7 @@
     build-depends:
                   aeson >= 1.4.7.1,
                   async,
-                  base >= 4.11.0 && < 4.17,
+                  base >= 4.11.0 && < 4.18,
                   bytestring >= 0.10.8.2,
                   cairo >= 0.13,
                   colour >= 2.3.6,
