summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-12-23 23:20:55 +0000
committerjao <jao@gnu.org>2022-12-23 23:20:55 +0000
commitd896b1a80f3bc5dc487971b1230cd2b4185b9404 (patch)
tree59207cc6e85ecc674318b556b547c4e55dcfb4e3
parent3f7a00defc69f9739c21390f6ba05990ff936b2b (diff)
downloadxmobar-d896b1a80f3bc5dc487971b1230cd2b4185b9404.tar.gz
xmobar-d896b1a80f3bc5dc487971b1230cd2b4185b9404.tar.bz2
Fix for #663: honour explicit bg/fg colors for icons
-rw-r--r--src/Xmobar/Draw/Cairo.hs7
-rw-r--r--src/Xmobar/Draw/Types.hs2
-rw-r--r--src/Xmobar/X11/Draw.hs5
3 files changed, 7 insertions, 7 deletions
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
index 4a94589..43276eb 100644
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -92,11 +92,14 @@ withRenderinfo ctx dctx seg@(C.Text _, inf, idx, a) = do
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 ()
diff --git a/src/Xmobar/Draw/Types.hs b/src/Xmobar/Draw/Types.hs
index 9853c38..1a076b3 100644
--- a/src/Xmobar/Draw/Types.hs
+++ b/src/Xmobar/Draw/Types.hs
@@ -25,7 +25,7 @@ type ActionPos = ([Action], Position, Position)
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/X11/Draw.hs b/src/Xmobar/X11/Draw.hs
index c0a8964..a1ec901 100644
--- a/src/Xmobar/X11/Draw.hs
+++ b/src/Xmobar/X11/Draw.hs
@@ -37,11 +37,8 @@ import qualified Xmobar.X11.XRender as XRender
#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 ()