summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-12-01 13:00:04 +0000
committerjao <jao@gnu.org>2018-12-01 13:00:04 +0000
commit836bcb7286275969ce4b22ad130384652c5821e8 (patch)
treee06b1adda60eefa75e74a128312b083c62aec441
parentb364bf310522e8304d644a77f335f47067a05500 (diff)
downloadxmobar-config-836bcb7286275969ce4b22ad130384652c5821e8.tar.gz
xmobar-config-836bcb7286275969ce4b22ad130384652c5821e8.tar.bz2
Working xmobar top/bottom configurations
-rw-r--r--.gitignore3
-rw-r--r--Setup.hs2
-rw-r--r--app/MPD.hs27
-rw-r--r--app/Mpris.hs20
-rw-r--r--app/Top.hs46
-rw-r--r--readme.md (renamed from README.md)0
-rw-r--r--src/Bottom.hs83
-rw-r--r--src/Config.hs71
-rw-r--r--stack.yaml8
-rw-r--r--xmobar-config.cabal41
10 files changed, 301 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..51321be
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+dist/
+.stack-work/
+*~
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 0000000..9a994af
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/app/MPD.hs b/app/MPD.hs
new file mode 100644
index 0000000..d237867
--- /dev/null
+++ b/app/MPD.hs
@@ -0,0 +1,27 @@
+import Xmobar
+import Config (palette)
+import qualified Bottom (config)
+
+mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t"
+ , " <lapsed> <fc=seashell3><fn=1><bar></fn></fc>"] 10
+
+autoMPD = AutoMPD [ "-T", "160", "-E", "...", "-W", "10", "-t"
+ , "<length> <ppos>/<plength> \
+ \<fn=0><fc=darkolivegreen><title></fc></fn> \
+ \<fn=0><album></fn> \
+ \<fn=0><fc=dodgerblue4><artist></fc> \
+ \<fc=burlywood4><composer></fc> <date></fn>"]
+
+
+config p = (Bottom.config [(Run mpd), (Run autoMPD)] p) {
+ template = "|kbd||default:Master| |default:Capture| \
+ \|mpd| |autompd| {} |mbox| \
+ \|EGPH| \
+ \|diskio| |disku| · |bright| · |coretemp| \
+ \|memory| · |uptime| |b0| "
+ , additionalFonts = ["xft:Hack-7"]
+ , textOffsets = [17]
+ }
+
+main :: IO ()
+main = palette >>= xmobar . config
diff --git a/app/Mpris.hs b/app/Mpris.hs
new file mode 100644
index 0000000..09c155d
--- /dev/null
+++ b/app/Mpris.hs
@@ -0,0 +1,20 @@
+import Xmobar
+import Config (palette)
+import qualified Bottom (config)
+
+mpris =
+ Mpris2 "spotify" -- "clementine" --
+ ["-t", " <tracknumber>\
+ \ <title> <fc=sienna4><artist></fc>\
+ \ <album> <length>"
+ , "-T", "180", "-E", "...", "-M", "100", "-x", ""] 10
+
+config p = (Bottom.config [Run mpris] p) {
+ template = "|kbd||default:Master| |default:Capture| \
+ \|mpris2| {} |mbox| \
+ \|EGPH| \
+ \|diskio| |disku| · |bright| · |coretemp| \
+ \|memory| · |uptime| |b0| "
+ }
+main :: IO ()
+main = palette >>= xmobar . config
diff --git a/app/Top.hs b/app/Top.hs
new file mode 100644
index 0000000..c14b56a
--- /dev/null
+++ b/app/Top.hs
@@ -0,0 +1,46 @@
+import Xmobar
+import Config
+
+topProc p = TopProc (p <~> ["-t" , "<mboth3> <mboth2> <mboth1> \
+ \· <both3> <both2> <both1>"
+ , "-w", "10", "-L" , "10", "-H", "80"]) 15
+
+wireless p = Wireless "wlan0" (p <~> ["-t" , "<essid> <quality>"
+ , "-W", "5", "-M", "15" , "-m", "2"
+ , "-L", "20", "-H", "80"]) 20
+
+multiCPU p = MultiCpu (p <~> ["-t", "<autototal>"
+ , "-S", "on", "-b", " ", "-f", "*"
+ , "-c", " " , "-L", "30", "-H", "70"
+ , "-p", "3", "-a", "l"]) 10
+
+cpuFreq p = CpuFreq (p <~> ["-t" , "<cpu0> <cpu1> <cpu2> <cpu3>"
+ , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50
+
+dynNetwork p = DynNetwork (p <~> ["-t", "↑ <tx> ↓ <rx>"
+ , "-L", "20", "-H", "1024000"
+ , "-m", "5", "-W", "10", "-S", "Off"]) 10
+
+network p = Network "tun0" ["-t", "<dev>:", "-x", ""] 20
+
+config p = (baseConfig p) {
+ position = Static {xpos=1, ypos=1, width=1920, height=24}
+ , textOffset = 16
+ , commands = [ Run (topProc p)
+ , Run (wireless p)
+ , Run (multiCPU p)
+ , Run (cpuFreq p)
+ , Run (dynNetwork p)
+ , Run (network p)
+ , Run XMonadLog
+ , Run (DateZone "%H" "en_US" "US/Pacific" "laTime" 10)
+ , Run (Date "%R" "datetime" 10)
+ ]
+ , template = " |top| {|XMonadLog|}\
+ \ |cpufreq| |multicpu| |dynnetwork|\
+ \ <action=`wicd-client -n`>|tun0||wlan0wi|</action>\
+ \ |datetime| |laTime| "
+}
+
+main :: IO ()
+main = palette >>= xmobar . config
diff --git a/README.md b/readme.md
index b057626..b057626 100644
--- a/README.md
+++ b/readme.md
diff --git a/src/Bottom.hs b/src/Bottom.hs
new file mode 100644
index 0000000..1c70548
--- /dev/null
+++ b/src/Bottom.hs
@@ -0,0 +1,83 @@
+module Bottom (config) where
+
+import Xmobar
+import Config
+
+uptime p = Uptime (p <~> [ "-t" , "<days> <hours>", "-m", "3", "-c", "0", "-S"
+ , "On" , "-L", "10", "-H", "100"]) 600
+
+weather st =
+ Weather st ["-t", "<tempC>° <rh>% <windKmh> <skyCondition> (<hour>)"
+ , "-L","10", "-H", "25", "--normal", "black",
+ "--high", "lightgoldenrod4", "--low", "darkseagreen4"] 18000
+
+batt p =
+ BatteryN ["BAT0"]
+ ((p <~> ["-t", "<left>%<acstatus>"
+ , "-S", "Off", "-d", "0", "-m", "3"
+ , "-L", "10", "-H", "80", "-p", "3"])
+ ++ [ "--"
+ , "-i", "", "-O", " <timeleft> <watts>"
+ , "-o", " <timeleft> <watts>"
+ , "-H", "16", "-L", "10"
+ , "-h", "sienna4", "-l", "gray20"]) 50 "b0"
+
+coreTemp p =
+ CoreTemp (p <~> ["-t", "<core1>° <core2>°"
+ , "-L", "50", "-H", "75", "-d", "0"]) 50
+
+diskU p =
+ DiskU [("dm-1", "<used>") , ("/media/sdb", " s <used>")]
+ (p <~> ["-L", "20", "-H", "70", "-m", "1", "-p", "3"])
+ 20
+
+diskIO p =
+ DiskIO [("dm-1", "↑ <read> ↓ <write>")]
+ (p <~> ["-L", "20", "-H", "5000", "-m", "5", "-p", "3"]) 10
+
+mbox = MBox [ ("I", "inbox", "darkseagreen4")
+ , ("B", "bigml.spool", "sienna4")
+ , ("S", "bigsup.spool", "sienna4")
+ , ("b", "bugml.spool", "sienna4")
+ , ("G", "geiser.spool", "darkseagreen4")
+ , ("X", "xmobar.spool", "darkseagreen4")
+ , ("g", "gnu.spool", "")
+ , ("k", "books.spool", "")
+ , ("h", "hacking.spool", "")
+ , ("c", "computers.spool", "")
+ , ("w", "words.spool", "")
+ , ("t", "think.spool", "")
+ ] ["-d", "/home/jao/var/mail", "-p", " ", "-s", ""] "mbox"
+
+
+masterVol =
+ Volume "default" "Master"
+ ["-t", "<status> <volume>"
+ , "--", "-C", "black", "-c", "sienna4", "-O", ""
+ , "-o", "×"] 10
+
+captureVol = Volume "default" "Capture" ["-t", "<volume>"] 10
+
+kbd = Kbd [("us", ""), ("us(intl)", "*")]
+
+brightness = Brightness ["--", "-D", "intel_backlight"] 10
+
+memory = Memory ["-t","<available> M", "-p", "2"] 20
+
+config cs p = (baseConfig p) {
+ position = BottomSize C 100 24
+ , textOffset = 17
+ , commands = [ Run (uptime p)
+ , Run brightness
+ , Run (weather "EGPH") -- LEGE, LEBL, KCV0
+ , Run memory
+ , Run (batt p)
+ , Run (coreTemp p)
+ , Run (diskU p)
+ , Run (diskIO p)
+ , Run mbox
+ , Run masterVol
+ , Run captureVol
+ , Run kbd
+ ] ++ cs
+}
diff --git a/src/Config.hs b/src/Config.hs
new file mode 100644
index 0000000..94b9211
--- /dev/null
+++ b/src/Config.hs
@@ -0,0 +1,71 @@
+module Config (Palette, baseConfig, palette, (<~>)) where
+
+import System.Environment (lookupEnv)
+
+import Xmobar
+
+data Palette = Palette { pNormal :: String
+ , pLow :: String
+ , pHigh :: String
+ , pFont :: String
+ , pBorder :: String
+ , pForeground :: String
+ , pBackground :: String
+ , pAlpha :: Int
+ }
+
+lightTheme :: IO Bool
+lightTheme = fmap (== (Just "light")) (lookupEnv "JAO_COLOR_SCHEME")
+
+lightPalette :: Palette
+lightPalette = Palette { pNormal = "black"
+ , pLow = "#4d4d4d"
+ , pHigh = "#a0522d"
+ , pFont = "xft:Source Code Pro Medium-9"
+ , pBorder = "grey70"
+ , pForeground = "#000000"
+ , pBackground = "white"
+ , pAlpha = 0
+ }
+
+darkPalette :: Palette
+darkPalette = Palette { pNormal = "black"
+ , pLow = "#4d4d4d"
+ , pHigh = "#a0522d"
+ , pFont = "xft:NotoMono-9,xft:Inconsolata-11"
+ , pBorder = "black"
+ , pForeground = "grey50"
+ , pBackground = "black"
+ , pAlpha = 102
+ }
+
+palette :: IO Palette
+palette = do
+ light <- lightTheme
+ if light then return lightPalette else return darkPalette
+
+baseConfig :: Palette -> Config
+baseConfig p = defaultConfig {
+ font = pFont p
+ , borderColor = pBorder p
+ , fgColor = (pForeground p)
+ , bgColor = (pBackground p)
+ , border = FullBM 1
+ , alpha = (pAlpha p)
+ , additionalFonts = []
+ , overrideRedirect = True
+ , lowerOnStart = True
+ , allDesktops = True
+ , hideOnStart = False
+ , persistent = True
+ , sepChar = "|"
+ , alignSep = "{}"
+ }
+
+(<~>) :: Palette -> [String] -> [String]
+(<~>) p args = concat [ args
+ , [ "--low", (pLow p)
+ , "--normal", (pNormal p)
+ , "--high", (pHigh p)
+ ]
+ ]
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 0000000..1f184eb
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,8 @@
+resolver: nightly-2018-10-28
+packages:
+- .
+- ../git
+extra-deps:
+- iwlib-0.1.0
+- alsa-mixer-0.2.0.3
+- libmpd-0.9.0.9
diff --git a/xmobar-config.cabal b/xmobar-config.cabal
new file mode 100644
index 0000000..e2c232c
--- /dev/null
+++ b/xmobar-config.cabal
@@ -0,0 +1,41 @@
+name: xmobar-config
+version: 0.1
+description: xmobar configs
+author: jao
+maintainer: jao@gnu.org
+copyright: 2018 Jose A Ortega Ruiz
+license: GPL-3
+build-type: Simple
+cabal-version: >= 1.10
+
+extra-source-files:
+ readme.md
+
+library
+ hs-source-dirs: src
+ exposed-modules: Config, Bottom
+ build-depends: base >=4.7 && <5, xmobar
+ other-modules:
+ Paths_xmobar_config
+ default-language: Haskell2010
+
+executable xmobar-top
+ main-is: Top.hs
+ hs-source-dirs: app
+ ghc-options: -rtsopts -with-rtsopts=-V0
+ build-depends: base, xmobar, xmobar-config
+ default-language: Haskell2010
+
+executable xmobar-mpris
+ main-is: Mpris.hs
+ hs-source-dirs: app
+ ghc-options: -rtsopts -with-rtsopts=-V0
+ build-depends: base, xmobar, xmobar-config
+ default-language: Haskell2010
+
+executable xmobar-mpd
+ main-is: MPD.hs
+ hs-source-dirs: app
+ ghc-options: -rtsopts -with-rtsopts=-V0
+ build-depends: base, xmobar, xmobar-config
+ default-language: Haskell2010