diff options
| author | jao <jao@gnu.org> | 2019-12-18 15:11:31 +0000 | 
|---|---|---|
| committer | jao <jao@gnu.org> | 2019-12-18 15:11:31 +0000 | 
| commit | 479a50b9e291ea5cd59e7df6a12fc537b4220254 (patch) | |
| tree | 1b3ffcf7b7edc7e7c8b51adf934e971aff93a67a | |
| parent | 318ce5d54950aea41bb2f3bfce73658a03bc691a (diff) | |
| download | xmobar-config-479a50b9e291ea5cd59e7df6a12fc537b4220254.tar.gz xmobar-config-479a50b9e291ea5cd59e7df6a12fc537b4220254.tar.bz2 | |
linting and doom background
| -rw-r--r-- | icons/dark/load_0.xpm | 2 | ||||
| -rw-r--r-- | icons/dark/load_1.xpm | 2 | ||||
| -rw-r--r-- | icons/dark/load_2.xpm | 2 | ||||
| -rw-r--r-- | icons/dark/load_3.xpm | 2 | ||||
| -rw-r--r-- | icons/dark/load_4.xpm | 4 | ||||
| -rw-r--r-- | icons/dark/load_5.xpm | 4 | ||||
| -rw-r--r-- | icons/dark/load_6.xpm | 4 | ||||
| -rw-r--r-- | icons/dark/load_7.xpm | 4 | ||||
| -rw-r--r-- | icons/dark/load_8.xpm | 6 | ||||
| -rwxr-xr-x | icons/gen-load-icons.sh | 2 | ||||
| -rw-r--r-- | src/lib/Config.hs | 36 | ||||
| -rw-r--r-- | src/lib/GMPDP.hs | 9 | ||||
| -rw-r--r-- | src/lib/Monitors.hs | 22 | 
13 files changed, 47 insertions, 52 deletions
| diff --git a/icons/dark/load_0.xpm b/icons/dark/load_0.xpm index c606ef3..20bc851 100644 --- a/icons/dark/load_0.xpm +++ b/icons/dark/load_0.xpm @@ -3,7 +3,7 @@ static char *load_0[] = {  "8 24 3 1",  "# c grey40",  "  c white", -"! c #2B2B2B", +"! c #22242b",  "!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_1.xpm b/icons/dark/load_1.xpm index e6af458..ec128a2 100644 --- a/icons/dark/load_1.xpm +++ b/icons/dark/load_1.xpm @@ -1,7 +1,7 @@  /* XPM */  static char *load_1[] = {  "8 24 3 1", -"! c #2B2B2B", +"! c #22242b",  "  c white",  "# c grey40",  "!!!!!!!!", diff --git a/icons/dark/load_2.xpm b/icons/dark/load_2.xpm index be87671..678feb2 100644 --- a/icons/dark/load_2.xpm +++ b/icons/dark/load_2.xpm @@ -2,8 +2,8 @@  static char *load_2[] = {  "8 24 3 1",  "# c grey40", -"! c #2B2B2B",  "  c white", +"! c #22242b",  "!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_3.xpm b/icons/dark/load_3.xpm index 2b0284f..72b766f 100644 --- a/icons/dark/load_3.xpm +++ b/icons/dark/load_3.xpm @@ -1,8 +1,8 @@  /* XPM */  static char *load_3[] = {  "8 24 3 1", +"! c #22242b",  "  c white", -"! c #2B2B2B",  "# c grey40",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_4.xpm b/icons/dark/load_4.xpm index 822f7fd..e83bee7 100644 --- a/icons/dark/load_4.xpm +++ b/icons/dark/load_4.xpm @@ -1,9 +1,9 @@  /* XPM */  static char *load_4[] = {  "8 24 3 1", -"# c grey40",  "  c white", -"! c #2B2B2B", +"# c grey40", +"! c #22242b",  "!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_5.xpm b/icons/dark/load_5.xpm index 97f629b..f2742a0 100644 --- a/icons/dark/load_5.xpm +++ b/icons/dark/load_5.xpm @@ -1,9 +1,9 @@  /* XPM */  static char *load_5[] = {  "8 24 3 1", -"  c white", -"! c #2B2B2B", +"! c #22242b",  "# c grey40", +"  c white",  "!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_6.xpm b/icons/dark/load_6.xpm index 28120fd..0142658 100644 --- a/icons/dark/load_6.xpm +++ b/icons/dark/load_6.xpm @@ -1,9 +1,9 @@  /* XPM */  static char *load_6[] = {  "8 24 3 1", -"# c grey40", -"! c #2B2B2B", +"! c #22242b",  "  c white", +"# c grey40",  "!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_7.xpm b/icons/dark/load_7.xpm index e75e79a..9c4a486 100644 --- a/icons/dark/load_7.xpm +++ b/icons/dark/load_7.xpm @@ -1,9 +1,9 @@  /* XPM */  static char *load_7[] = {  "8 24 3 1", -"# c grey40", +"! c #22242b",  "  c white", -"! c #2B2B2B", +"# c grey40",  "!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", diff --git a/icons/dark/load_8.xpm b/icons/dark/load_8.xpm index 192056e..2f7a5e3 100644 --- a/icons/dark/load_8.xpm +++ b/icons/dark/load_8.xpm @@ -2,12 +2,12 @@  static char *load_8[] = {  "8 24 3 1",  "  c white", -"! c #2B2B2B",  "# c grey40", +"! c #22242b", +"!!!!!!!!", +"!!!!!!!!",  "!!!!!!!!",  "!!!!!!!!", -"########", -"########",  "########",  "########",  "########", diff --git a/icons/gen-load-icons.sh b/icons/gen-load-icons.sh index 12f61ed..d3072de 100755 --- a/icons/gen-load-icons.sh +++ b/icons/gen-load-icons.sh @@ -14,6 +14,8 @@ my $color_bg = "white";  my $color_fg = "grey90";  $color_bg = "#2B2B2B"; +$color_bg = "#1f1f1f"; # zenburn +$color_bg = "#22242b"; # doom  $color_fg = "grey40";  for ( my $file_num = 0; $file_num <= 8; $file_num++ ) { diff --git a/src/lib/Config.hs b/src/lib/Config.hs index a8a8dc1..905773e 100644 --- a/src/lib/Config.hs +++ b/src/lib/Config.hs @@ -22,7 +22,7 @@ data Palette = Palette { pNormal :: String                         }  lightTheme :: IO Bool -lightTheme = fmap (== (Just "light")) (lookupEnv "JAO_COLOR_SCHEME") +lightTheme = fmap (== Just "light") (lookupEnv "JAO_COLOR_SCHEME")  icons k = "/home/jao/.config/xmobar/icons/" ++ k @@ -40,11 +40,13 @@ lightPalette = Palette { pNormal = "black"                         }  zenburnRed = "#CC9393" -zenburnBack = "#2B2B2B" +-- zenburnBack = "#2B2B2B" +zenburnBack = "#1f1f1f"  zenburnBackLight = "#383838"  zenburnFg = "#989890" -- "#DCDCCC"  zenburnYl = "#F0DFAF"  zenburnGreen = "#7F9F7F" +doomBack = "#22242b"  darkPalette :: Palette  darkPalette = Palette { pNormal = zenburnFg @@ -52,9 +54,9 @@ darkPalette = Palette { pNormal = zenburnFg                        , pHigh = zenburnRed                        , pFont = "xft:Source Code Pro Medium-9"                        -- , pFont = "xft:NotoMono-9,xft:Inconsolata-11" -                      , pBorder = zenburnBackLight +                      , pBorder = "black" -- zenburnBackLight                        , pForeground = zenburnFg -                      , pBackground = zenburnBack +                      , pBackground = doomBack -- zenburnBack                        , pAlpha = 255                        , pIconRoot = icons "dark"                        , pIsLight = False @@ -69,15 +71,15 @@ baseConfig :: Palette -> Config  baseConfig p = defaultConfig {    font = pFont p    , borderColor = pBorder p -  , fgColor = (pForeground p) -  , bgColor = (pBackground p) +  , fgColor = pForeground p +  , bgColor = pBackground p    , additionalFonts = [ "xft:Symbola-9"                        , "xft:Symbola-10"                        , "xft:Symbola-11"                        , "xft:Symbola-11"                        , "xft:Hack-7"]    , border = NoBorder -  , alpha = (pAlpha p) +  , alpha = pAlpha p    , overrideRedirect = True    , lowerOnStart = True    , hideOnStart = False @@ -85,24 +87,16 @@ baseConfig p = defaultConfig {    , persistent = True    , sepChar = "|"    , alignSep = "{}" -  , iconRoot = (pIconRoot p) +  , iconRoot = pIconRoot p    }  (<~>) :: Palette -> [String] -> [String] -(<~>) p args = concat [ args -                      , [ "--low", (pLow p) -                        , "--normal", (pNormal p) -                        , "--high", (pHigh p) -                        ] -                      ] +(<~>) p args = +  args ++ [ "--low", pLow p , "--normal", pNormal p , "--high", pHigh p]  (>~<) :: Palette -> [String] -> [String] -(>~<) p args = concat [ args -                      , [ "--low", (pHigh p) -                        , "--normal", (pNormal p) -                        , "--high", (pLow p) -                        ] -                      ] +(>~<) p args = +  args ++ [ "--low", pHigh p , "--normal", pNormal p , "--high", pLow p]  mkArgs :: Palette -> [String] -> [String] -> [String] -mkArgs p args extra = concat [(p <~> args), ["--"], extra] +mkArgs p args extra = concat [p <~> args, ["--"], extra] diff --git a/src/lib/GMPDP.hs b/src/lib/GMPDP.hs index 370e360..d7e36de 100644 --- a/src/lib/GMPDP.hs +++ b/src/lib/GMPDP.hs @@ -7,14 +7,13 @@ module GMPDP where  import Data.Aeson  import Data.Text  import Control.Applicative -import Control.Monad  import qualified Data.ByteString.Lazy as B  import Network.HTTP.Conduit (simpleHttp)  import GHC.Generics  import Xmobar -import Control.Monad (when) +import Control.Monad (when, guard)  import Control.Concurrent.STM  import Control.Exception (SomeException (..), handle, evaluate) @@ -61,7 +60,7 @@ getGMPDPStatus = do        Left _ -> return Nothing        Right r -> return $ Just r -data GMPDP = GMPDP String deriving (Show,Read,Generic) +newtype GMPDP = GMPDP String deriving (Show,Read,Generic)  handleNotification :: TVar (Maybe GMPDPStatus) -> Event -> IO ()  handleNotification v _ = @@ -70,8 +69,8 @@ handleNotification v _ =  formatStatus Nothing = ""  formatStatus (Just s) =    fmtt (current $ time s) ++ "/" ++ fmtt (total $ time s) ++ -  " " ++ (title $ song s) ++ " <fc=sienna4>" ++ (album $ song s) ++ "</fc>" ++ -  " " ++ (artist $ song s) +  " " ++ title (song s) ++ " <fc=sienna4>" ++ album (song s) ++ "</fc>" ++ +  " " ++ artist (song s)    where fmtt ms = let s = ms `div` 1000                        sr x = if x < 10 then "0" ++ show x else show x                    in sr (s `div` 60) ++ ":" ++ sr (s `mod` 60) diff --git a/src/lib/Monitors.hs b/src/lib/Monitors.hs index d589ce1..7d57f5d 100644 --- a/src/lib/Monitors.hs +++ b/src/lib/Monitors.hs @@ -15,7 +15,7 @@ instance (Read a, Read b) => Read (CombinedMonitor a b) where    readsPrec _ = undefined  instance (Exec a, Exec b) => Exec (CombinedMonitor a b) where -  alias (CombinedMonitor a b _) = (alias a) ++ "_" ++ (alias b) +  alias (CombinedMonitor a b _) = alias a ++ "_" ++ alias b    rate (CombinedMonitor a b _) = min (rate a) (rate b)    start (CombinedMonitor a b comb) cb      = startMonitors a b (\s t -> cb $ comb s t) @@ -23,22 +23,22 @@ instance (Exec a, Exec b) => Exec (CombinedMonitor a b) where  startMonitors a b cmb =  do      sta <- atomically $ newTVar ""      stb <- atomically $ newTVar "" -    _ <- async $ start a (\x -> atomically $ writeTVar sta x) -    _ <- async $ start b (\x -> atomically $ writeTVar stb x) +    _ <- async $ start a (atomically . writeTVar sta) +    _ <- async $ start b (atomically . writeTVar stb)      go sta stb        where go sta' stb' = do -              s <- atomically $ readTVar sta' -              t <- atomically $ readTVar stb' +              s <- readTVarIO sta' +              t <- readTVarIO stb'                cmb s t                tenthSeconds $ min (rate b) (rate a)                go sta' stb'  guardedMonitor a p = CombinedMonitor (PipeReader p (alias a ++ "_g")) a f -  where f s t = if (null s || head s == '0') then "" else t +  where f s t = if null s || head s == '0' then "" else t  altMonitor a b = CombinedMonitor a b (\s t -> if null s then t else s)  concatMonitor sep a b = CombinedMonitor a b (\s t -> s ++ sep ++ t) -toggleMonitor path a b = altMonitor (guardedMonitor a path) b +toggleMonitor path a = altMonitor (guardedMonitor a path)  topProc p = TopProc (p <~> ["-t" , "<mboth3>  <mboth2>  <mboth1> \                                     \ยท <both3>  <both2>  <both1>" @@ -101,7 +101,7 @@ batt p =             ["-t", "<acstatus> <left>"             , "-S", "Off", "-d", "0", "-m", "3"             , "-L", "10", "-H", "90", "-p", "3" -           , "--low", (pHigh p), "--normal", (pNormal p), "--high", (pLow p) +           , "--low", pHigh p, "--normal", pNormal p, "--high", pLow p             , "--"             , "-P"             , "-a", "notify-send -u critical 'Battery running out!!!!!!'" @@ -110,7 +110,7 @@ batt p =             , "-O", " <fn=2>\9211</fn> <timeleft> <watts>"             , "-o", " <fn=2>๐</fn> <timeleft> <watts>"             , "-H", "10", "-L", "7" -           , "-h", (pHigh p), "-l", (pLow p)] 50 "batt0" +           , "-h", pHigh p, "-l", pLow p] 50 "batt0"  avgCoretemp p =    MultiCoreTemp (p <~> ["-t", "<avg>ยฐ" @@ -128,7 +128,7 @@ diskU p =  diskArgs p = mkArgs p                  ["-f", "โ", "-b", " ", "-L", "10000000", "-H" , "100000000"                  , "-W", "5", "-w", "5", "-p", "3"] -                ["--total-icon-pattern", "<icon=load_%%.xpm/>"] +                ["--total-icon-pattern", "<icon=load_%%.xpm/>", "-c"]  diskIO p =    DiskIO [("nvme0n1p2" @@ -177,7 +177,7 @@ masterVol =    Volume "default" "Master"                    ["-t", "<status> <volume>"                    , "--", "-C", "black", "-c", "sienna4" -                  , "-O", "<fn=4>๐ง</fn>" +                  , "-O", "<fn=4>๐ง</fn>" -- ๐ง                    , "-o", "<fn=4>๐</fn>"] 10  captureVol = Volume "default" "Capture" ["-t", "<volume>"] 10 | 
