forked from taffybar/taffybar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
taffybar.hs.example
43 lines (39 loc) · 1.67 KB
/
taffybar.hs.example
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
module Main where
import System.Information.CPU
import System.Information.Memory
import System.Taffybar
import System.Taffybar.FreedesktopNotifications
import System.Taffybar.MPRIS
import System.Taffybar.SimpleClock
import System.Taffybar.Systray
import System.Taffybar.TaffyPager
import System.Taffybar.Weather
import System.Taffybar.Widgets.PollingBar
import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.WorkspaceHUD
memCallback = do
mi <- parseMeminfo
return [memoryUsedRatio mi]
cpuCallback = do
(userLoad, systemLoad, totalLoad) <- cpuLoad
return [totalLoad, systemLoad]
main = do
let memCfg = defaultGraphConfig { graphDataColors = [(1, 0, 0, 1)]
, graphLabel = Just "mem"
}
cpuCfg = defaultGraphConfig { graphDataColors = [ (0, 1, 0, 1)
, (1, 0, 1, 0.5)
]
, graphLabel = Just "cpu"
}
let clock = textClockNew Nothing "<span fgcolor='orange'>%a %b %_d %H:%M</span>" 1
pager = taffyPagerHUDNew defaultPagerConfig defaultWorkspaceHUDConfig
note = notifyAreaNew defaultNotificationConfig
wea = weatherNew (defaultWeatherConfig "KMSN") 10
mpris = mprisNew defaultMPRISConfig
mem = pollingGraphNew memCfg 1 memCallback
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback
tray = systrayNew
defaultTaffybar defaultTaffybarConfig { startWidgets = [ pager, note ]
, endWidgets = [ tray, wea, clock, mem, cpu, mpris ]
}