diff options
author | jao <jao@gnu.org> | 2018-12-08 02:39:19 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-12-08 02:39:19 +0000 |
commit | 0b8f1901f6e955fb1f0f42b0b6b598bbf8a2ae12 (patch) | |
tree | 4e524a9179ac8d2d8be1f2a05b495ed60c3b5a02 | |
parent | 5d68d556eaa107fc01a67c661f600812a4a64e40 (diff) | |
download | xmobar-config-0b8f1901f6e955fb1f0f42b0b6b598bbf8a2ae12.tar.gz xmobar-config-0b8f1901f6e955fb1f0f42b0b6b598bbf8a2ae12.tar.bz2 |
Unifying MPD and Mpris in a single exec
-rw-r--r-- | src/Bottom.hs | 14 | ||||
-rw-r--r-- | src/lib/Bottom.hs | 2 | ||||
-rw-r--r-- | src/lib/MPD.hs (renamed from src/MPD.hs) | 5 | ||||
-rw-r--r-- | src/lib/Mpris.hs (renamed from src/Mpris.hs) | 10 | ||||
-rw-r--r-- | xmobar-config.cabal | 13 |
5 files changed, 25 insertions, 19 deletions
diff --git a/src/Bottom.hs b/src/Bottom.hs new file mode 100644 index 0000000..bfc4ecb --- /dev/null +++ b/src/Bottom.hs @@ -0,0 +1,14 @@ +import Xmobar +import Config +import qualified MPD +import qualified Mpris + +import System.Environment (getArgs) + +main :: IO () +main = do + args <- getArgs + let mpris = if null args then "spotify" else head args + if mpris == "mpd" + then palette >>= xmobar . MPD.config + else palette >>= xmobar . (Mpris.config mpris) diff --git a/src/lib/Bottom.hs b/src/lib/Bottom.hs index 4bd6614..0c6a372 100644 --- a/src/lib/Bottom.hs +++ b/src/lib/Bottom.hs @@ -54,7 +54,7 @@ masterVol = Volume "default" "Master" ["-t", "<status> <volume>" , "--", "-C", "black", "-c", "sienna4", "-O", "" - , "-o", "×"] 10 + , "-o", " ×"] 10 captureVol = Volume "default" "Capture" ["-t", "<volume>"] 10 diff --git a/src/MPD.hs b/src/lib/MPD.hs index d237867..be09f5f 100644 --- a/src/MPD.hs +++ b/src/lib/MPD.hs @@ -1,3 +1,5 @@ +module MPD where + import Xmobar import Config (palette) import qualified Bottom (config) @@ -22,6 +24,3 @@ config p = (Bottom.config [(Run mpd), (Run autoMPD)] p) { , additionalFonts = ["xft:Hack-7"] , textOffsets = [17] } - -main :: IO () -main = palette >>= xmobar . config diff --git a/src/Mpris.hs b/src/lib/Mpris.hs index 09c155d..1936d57 100644 --- a/src/Mpris.hs +++ b/src/lib/Mpris.hs @@ -1,20 +1,20 @@ +module Mpris where + import Xmobar import Config (palette) import qualified Bottom (config) -mpris = - Mpris2 "spotify" -- "clementine" -- +mpris client = + Mpris2 client -- "clementine" -- ["-t", " <tracknumber>\ \ <title> <fc=sienna4><artist></fc>\ \ <album> <length>" , "-T", "180", "-E", "...", "-M", "100", "-x", ""] 10 -config p = (Bottom.config [Run mpris] p) { +config client p = (Bottom.config [Run (mpris client)] 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/xmobar-config.cabal b/xmobar-config.cabal index a255014..4ab8d73 100644 --- a/xmobar-config.cabal +++ b/xmobar-config.cabal @@ -13,7 +13,7 @@ extra-source-files: library hs-source-dirs: src/lib - exposed-modules: Config, Bottom + exposed-modules: Config, Bottom, Mpris, MPD build-depends: base >=4.7 && <5, xmobar other-modules: Paths_xmobar_config @@ -26,15 +26,8 @@ executable xmobar-top build-depends: base, xmobar, xmobar-config default-language: Haskell2010 -executable xmobar-mpris - main-is: Mpris.hs - hs-source-dirs: src - ghc-options: -rtsopts -with-rtsopts=-V0 - build-depends: base, xmobar, xmobar-config - default-language: Haskell2010 - -executable xmobar-mpd - main-is: MPD.hs +executable xmobar-bottom + main-is: Bottom.hs hs-source-dirs: src ghc-options: -rtsopts -with-rtsopts=-V0 build-depends: base, xmobar, xmobar-config |