summaryrefslogtreecommitdiffhomepage
path: root/src/lib/Music.hs
blob: 0fdb87c7c7081f27d5909cea0442ef04973ec295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module Music where

import Xmobar
import Monitors
import qualified Bottom
import Config (defaultHeight)
import GMPDP (GMPDP(..))

mpris client width =
  Mpris2 client -- "clementine" --
         ["-t", " <fn=0><tracknumber>\
                \ <title> <fc=sienna4><artist></fc>\
                \ <album> <length></fn>"
         , "-T", show width, "-E", "...", "-M", "100", "-x", ""] 10

mprisConfig client p = Bottom.config [Run (mpris client 165)] "|mpris2|" p

mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t"
          , " <lapsed> <fc=honeydew3><fn=5><bar></fn></fc>"] 10 -- fn=5


autoMPD l = AutoMPD [ "-T", l, "-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>"]

mpdConfig p = (Bottom.config [Run mpd, Run (autoMPD "150")] "|mpd| |autompd|" p)
  {
  textOffsets = [defaultHeight - 7, defaultHeight - 6]
  }

compMPD = concatMonitor " " mpd (autoMPD "150")
alt x = altMonitor (mpris x 165) compMPD

gpmd = Run (GMPDP "gmpdp")

config cl =
  if cl == "mpd"
  then mpdConfig
  else Bottom.config [Run (alt cl)] "|mpris2_mpd_autompd|"