summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-11 02:36:35 +0100
committerjao <jao@gnu.org>2022-09-11 02:52:00 +0100
commit5df496dfff0d081a2e3448affc50a016f71b57b2 (patch)
tree4029a5c23d84a387a8e2b20a7421cad1462ed8e8
parentd0f547be5380ec14cc334b15a530ba869668581a (diff)
downloadxmobar-5df496dfff0d081a2e3448affc50a016f71b57b2.tar.gz
xmobar-5df496dfff0d081a2e3448affc50a016f71b57b2.tar.bz2
cairo: linting
-rw-r--r--src/Xmobar/Config/Types.hs4
-rw-r--r--src/Xmobar/X11/CairoDraw.hs10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/Xmobar/Config/Types.hs b/src/Xmobar/Config/Types.hs
index 216ac19..3f2297f 100644
--- a/src/Xmobar/Config/Types.hs
+++ b/src/Xmobar/Config/Types.hs
@@ -77,12 +77,12 @@ data Config =
indexedFont :: Config -> Int -> String
indexedFont config idx =
if idx < 1 || idx > length (additionalFonts config)
- then font config else (additionalFonts config) !! (idx - 1)
+ then font config else additionalFonts config !! (idx - 1)
indexedOffset :: Config -> Int -> Int
indexedOffset config idx =
if idx < 1 || idx > length (textOffsets config)
- then textOffset config else (textOffsets config) !! (idx - 1)
+ then textOffset config else textOffsets config !! (idx - 1)
data XPosition = Top
| TopH Int
diff --git a/src/Xmobar/X11/CairoDraw.hs b/src/Xmobar/X11/CairoDraw.hs
index 32adac2..4ed8d84 100644
--- a/src/Xmobar/X11/CairoDraw.hs
+++ b/src/Xmobar/X11/CairoDraw.hs
@@ -46,7 +46,7 @@ drawInPixmap p w h s = do
vis = defaultVisualOfScreen (defaultScreenOfDisplay disp)
c = config xconf
fi = fromIntegral
- render = (renderSegments c w h s)
+ render = renderSegments c w h s
liftIO $ withXlibSurface disp p vis (fi w) (fi h) render
segmentMarkup :: Config -> Segment -> String
@@ -61,7 +61,7 @@ segmentMarkup _ _ = ""
withLayoutInfo :: P.PangoContext -> Double -> Config -> Segment -> IO LayoutInfo
withLayoutInfo ctx maxh conf seg@(Text _, inf, idx, a) = do
lyt <- P.layoutEmpty ctx
- mk <- (P.layoutSetMarkup lyt (segmentMarkup conf seg)) :: IO String
+ mk <- P.layoutSetMarkup lyt (segmentMarkup conf seg) :: IO String
(_, P.PangoRectangle o u w h) <- P.layoutGetExtents lyt
let voff' = fromIntegral $ indexedOffset conf idx
voff = voff' + (maxh - h + u) / 2.0
@@ -88,7 +88,7 @@ setSourceColor :: RGBS.Colour Double -> C.Render ()
setSourceColor = RGBS.uncurryRGB C.setSourceRGB . SRGB.toSRGB
readColourName :: String -> IO (RGBS.Colour Double)
-readColourName str = do
+readColourName str =
case CNames.readColourName str of
Just c -> return c
Nothing -> return $ SRGB.sRGB24read str
@@ -96,10 +96,10 @@ readColourName str = do
background :: Config -> SRGB.Colour Double -> C.Render ()
background conf colour = do
setSourceColor colour
- C.paintWithAlpha $ (fromIntegral (alpha conf)) / 255.0
+ C.paintWithAlpha $ fromIntegral (alpha conf) / 255.0
renderBackground :: Config -> Surface -> IO ()
-renderBackground conf surface = do
+renderBackground conf surface =
when (alpha conf >= 255)
(readColourName (bgColor conf) >>= C.renderWith surface . background conf)