summaryrefslogtreecommitdiffhomepage
path: root/src/Single.hs
blob: c8e511580ce36096e2ec16b0c7d6cb968715b086 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import Xmobar
import Config
import Monitors
import Music (mpris, gpmd, mpdt)

memoratio = Memory ["-t","<usedratio>%", "-p", "2", "-W", "3"] 20

topProcL p = TopProc (p <~> ["-t"
                            , memTemp
                              ++ "  ·  <mboth1>  <mboth2>  <mboth3>  <mboth4>"
                            , "-w", "12", "-L" , "10", "-H", "80"]) 15
             where memTemp = if pIsLight p
                             then "<both1>  <both2>  <both3>  <both4>"
                             else "<both1>  <both2>  <both3>  <both4>"

diskIOL p = DiskIO [("/", "<totalbipat>"), ("/home", "<totalbipat>")]
                   (diskArgs p) 10

diskIOS p = DiskIO [("/", "<read> <write>")] (diskArgs p) 10

mpd a p i =
  MPDX [ "-W", "12", "-b", "░", "-f", "▒", "-t", "<statei> <remaining>"
       , "--", "-p", p, "-P", fni "\xf144", "-Z", fni i, "-S", fni i] 20 a

mpdMon = mpd "mpd" "6600" "\xf001"
mopMon = mpd "mopidy" "6669" "\xf1bc"

cpuFreq' p = CpuFreq (p <~> ["-t" , "<avg>"
                            , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50

cpus p = MultiCpu (mkArgs p
                    ["--template" , "<autobar> <total>%"
                    , "-L", "50", "-H", "85", "-W", "0", "-w", "3"
                    , "-f", "0123456789"]
                    ["--fallback-icon-pattern", "<icon=load_%%.xpm/>"]) 10


memory' = Memory [ "-t" ,"<usedbar> <usedratio>"
                 , "-p", "2", "-W", "0","-d", "1", "-f", "0123456789"
                 , "--", "--scale", "1024"] 20


config p = (baseConfig p) {
  position = TopSize C 100 (defaultHeight - 2)
  , font = "xft:Hack-8"
  , textOffset = defaultHeight - 8
  , textOffsets = [defaultHeight - 9, defaultHeight - 9,
                   defaultHeight - 6, defaultHeight - 8,
                   defaultHeight - 8, defaultHeight - 8]
  , alpha = if pIsLight p then 192 else 230
  , border = FullB
  , commands = [ Run (topProcL p)
               , Run (load p)
               , Run (iconBatt p)
               , Run (cpu p)
--               , Run (cpus p)
               , Run memory
               , Run (diskU p)
               , Run (diskIOS p)
               , Run brightness
               , Run (kbd p)
               , Run (coreTemp p)
               , Run (wireless p "wlp164s0")
               , Run (dynNetwork p)
               , Run (vpnMark "wg-mullvad")
               , Run tun0
               , Run (masterVol p)
               , Run captureVol
               , Run laTime
               , Run localTime
               , Run (cpuFreq' p)
               , Run w -- LEGE, LEBL, KCV0
               ] ++ extraCmds
  , template = trayT
             ++ " |batt0|" ++ sep
             -- ++ dimi "\xf26c" ++ sep
             ++ "|bright|" ++ sep
             ++ "<action=`toggle-app.sh nm-applet`>"
             ++ " |wg-mullvad||tun0||wlp164s0wi|"
             ++ "</action>"
             ++ " |dynnetwork| " ++ sep
             ++ "<action=`toggle-app.sh pasystray`>"
             ++ "  |default:Master| " ++ dimi "\xf130" ++ " |default:Capture|"
             ++ "</action>" ++ sep
             ++ " |EGPH| " ++ sep
             ++ eLog p
             ++ " {} "
             ++ "|kbd|" ++ sep
             ++ "|load|" ++ sep
             ++ "|cpufreq|" ++ sep
             ++ "|multicpu|" ++ sep
             ++ "|multicoretemp|" ++ sep
             ++ " |top| " ++ sep
             ++ " " ++ fni "\xf0c9" ++ " |memory| "
             ++ " |diskio| |disku| " ++ sep
             ++ "  |datetime| "
             ++ "|laTime| "
  } where dimi = fc (pDim p) . fni
          sep = "  "
          w = weather' "<skyConditionS> <tempC>° <weather>" "EGPH" p
          isXmonad = pWm p == Just "xmonad"
          trayT = if isXmonad then "|tray|" else ""
          eLog p = if isXmonad then "|XMonadLog|" else fc (pHigh p) "|elog|"
          extraCmds = if isXmonad
                      then [ Run (NamedXPropertyLog "_XMONAD_TRAYPAD" "tray")
                           , Run XMonadLog]
                      else [Run (NamedXPropertyLog "_EMACS_LOG" "elog")]

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