summaryrefslogtreecommitdiffhomepage
path: root/src/TopC.hs
blob: 54c3bb826807e164132c84d9e1021ae159f18198 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import Xmobar
import Config
import Monitors
import Music (mpris)

topProcL p = TopProc (p <~> ["-t" , "<both1>  <mboth1>"
                            , "-w", "10", "-L" , "10", "-H", "80"]) 15
diskIOL p = DiskIO [("nvme0n1p2", "<total>")] (diskArgs p) 10

mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t", " <remaining>"] 10

autoMPD = AutoMPD [ "-T", "110", "-E", "…", "-W", "10", "-t"
                  , "<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>"]

autoMPDD = AutoMPD [ "-T", "110", "-E", "…", "-W", "10", "-t"
                   , "<ppos>/<plength> \
                     \<fn=0><title></fn> \
                     \<fn=0><fc=darkseagreen><album></fc></fn> \
                     \<fn=0><fc=darkseagreen4><artist></fc> \
                     \<fc=burlywood4><composer></fc> <date></fn>"]

compMPD light = concatMonitor " " mpd (if light then autoMPD else autoMPDD)
music light = toggleMonitor "/tmp/mpris.st" (mpris "spotify" 120) (compMPD light)

-- <fn=1> 💡 </fn>
config p = (baseConfig p) {
  position = TopSize C 100 (defaultHeight - 1)
  , textOffset = defaultHeight - 8
  , textOffsets = [defaultHeight - 9, defaultHeight - 9,
                   defaultHeight - 6, defaultHeight - 8]
  , border = BottomB
  , alpha = 255
  , commands = [ Run (topProcL p)
               , Run m
               , Run (cpuBars p)
               , Run memory
               , Run (diskU p)
               , Run (diskIOL p)
               , Run brightness'
               , Run kbd
               , Run (batt p)
               , Run (wireless p "wlp1s0")
               , Run (dynNetwork p)
               , Run tun0
               , Run (weather "EGPH" p) -- LEGE, LEBL, KCV0
               , Run mail
               , Run masterVol
               , Run captureVol
               , Run laTime
               , Run localTime
               ]
  , template = " |batt0| |bright|\
               \ <action=`toggle-app.sh nm-applet`>|tun0||wlp1s0wi|</action> \
               \ |dynnetwork| \
               \ <action=`toggle-app.sh pasystray`>|default:Master|\
               \ |default:Capture|</action>  |EGPH|\
               \ |mail| <fn=1>|kbd|</fn>{}\
               \ <action=`toggle-pipe.sh /tmp/mpris.st`>|" ++ (alias m) ++
               "|</action>\
               \ |multicpu|  |top| |memory|\
               \ |diskio| |disku| \
               \ <fn=2>🕓  </fn>|datetime| |laTime| "
  } where m = music (pIsLight p)

main :: IO ()
main =
  palette >>= configFromArgs . config >>= xmobar