|
|
@ -4,12 +4,23 @@ import System.Taffybar.Systray
|
|
4
|
4
|
import System.Taffybar.XMonadLog
|
|
5
|
5
|
import System.Taffybar.SimpleClock
|
|
6
|
6
|
import System.Taffybar.Widgets.PollingGraph
|
|
|
7
|
import System.Taffybar.Widgets.PollingLabel
|
|
7
|
8
|
import System.Information.CPU
|
|
|
9
|
import System.Information.Memory (parseMeminfo, memoryUsedRatio)
|
|
|
10
|
import Graphics.UI.Gtk (widgetShowAll)
|
|
8
|
11
|
|
|
9
|
12
|
cpuCallback = do
|
|
10
|
13
|
(_, systemLoad, totalLoad) <- cpuLoad
|
|
11
|
14
|
return [ totalLoad, systemLoad ]
|
|
12
|
15
|
|
|
|
16
|
formatMeminfo m = "Mem: " ++ memPercentage ++ "%"
|
|
|
17
|
where memPercentage = show . truncate . ((*) 100) $ memoryUsedRatio m
|
|
|
18
|
|
|
|
19
|
textMemoryNew intervalSeconds = do
|
|
|
20
|
memLabel <- pollingLabelNew "" intervalSeconds (parseMeminfo >>= return . formatMeminfo)
|
|
|
21
|
widgetShowAll memLabel
|
|
|
22
|
return memLabel
|
|
|
23
|
|
|
13
|
24
|
main = do
|
|
14
|
25
|
let cpuCfg = defaultGraphConfig {
|
|
15
|
26
|
graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)]
|
|
|
@ -18,9 +29,10 @@ main = do
|
|
18
|
29
|
log = xmonadLogNew
|
|
19
|
30
|
tray = systrayNew
|
|
20
|
31
|
cpu = pollingGraphNew cpuCfg 3 cpuCallback
|
|
21
|
|
battery = textBatteryNew "%d%%" 30
|
|
|
32
|
battery = textBatteryNew "Bat: %d%%" 30
|
|
|
33
|
memory = textMemoryNew 3
|
|
22
|
34
|
defaultTaffybar defaultTaffybarConfig {
|
|
23
|
35
|
barHeight = 15,
|
|
24
|
36
|
startWidgets = [log],
|
|
25
|
|
endWidgets = [tray, clock, battery, cpu]
|
|
|
37
|
endWidgets = [tray, clock, memory, battery, cpu]
|
|
26
|
38
|
}
|