packages feed

i3blocks-hs-contrib 2.0.1 → 2.1.0

raw patch · 2 files changed

+17/−12 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Temperature/Main.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE LambdaCase #-}  module Main where @@ -11,20 +12,24 @@  main :: IO () main = do-  icons <- getArgs-  sh $ liftIO . putStrLn . formatBlock icons =<< cpuTemperature+  args <- getArgs+  sh $ liftIO . putStrLn . formatBlock args =<< cpuTemperature (getSensor args)  formatBlock :: [String] -> Text -> Text formatBlock icons temp =   let icon = fromMaybe "" $ getIcon icons-  in icon <> temp <> "°C"+  in icon <> temp +getSensor :: [String] -> Text+getSensor = pack . head+ getIcon :: [String] -> Maybe Text-getIcon icons = case icons of-  icon : _ -> Just $ pack icon-  _        -> Nothing+getIcon = \case+  _ : icon : _ -> Just $ pack icon+  _            -> Nothing -cpuTemperature :: Shell Text-cpuTemperature-  = strip-  <$> strict (inshell "sensors | grep -oP 'Package[^\\+]*\\+\\K[0-9]+'" mempty)+cpuTemperature :: Text -> Shell Text+cpuTemperature sensor+  = strip <$> strict (inshell cmd mempty)+  where+    cmd = "sensors | grep '" <> sensor <> "' | cut -d':' -f2 | awk '{$1=$1};1' | cut -d' ' -f1"
i3blocks-hs-contrib.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 03f4f39fbd4722afa2273b250b58b2172c3d7c6de6c7c332a4f8c9ad7ee58027+-- hash: e30a7cecad9b9057ad7c9f41a629e90ddd2fcd0373f19639ce42d69eab863341  name:           i3blocks-hs-contrib-version:        2.0.1+version:        2.1.0 synopsis:       Base i3blocks written in haskell description:    @i3blocks-hs-contrib@ defines a set of blocks for your i3 bar category:       Distribution