Skip to content

Instantly share code, notes, and snippets.

@fujin
Created January 13, 2014 23:14
Show Gist options
  • Save fujin/8409962 to your computer and use it in GitHub Desktop.
Save fujin/8409962 to your computer and use it in GitHub Desktop.
import System.Taffybar
import System.Taffybar.Systray
import System.Taffybar.XMonadLog
import System.Taffybar.SimpleClock
import System.Taffybar.FreedesktopNotifications
import System.Taffybar.DiskIOMonitor
import System.Taffybar.CPUMonitor
import System.Taffybar.FSMonitor
import System.Taffybar.NetMonitor
import System.Taffybar.MPRIS
import System.Taffybar.Widgets.PollingBar
import System.Taffybar.Widgets.PollingGraph
import System.Information.Memory
import System.Information.CPU
import Data.Time.LocalTime
memCallback = do
mi <- parseMeminfo
return [memoryUsedRatio mi]
main = do
let memCfg = defaultGraphConfig { graphDataColors = [ (1, 0, 0, 1)]
, graphLabel = Just "mem"
}
let cpuCfg = defaultGraphConfig { graphDataColors = [ (0, 1, 0, 1)
, (1, 0, 1, 0.5) ]
, graphLabel = Just "cpu"
}
let diskCfg = defaultGraphConfig { graphDataColors = [ (0, 1, 0, 1),
(1, 0, 1, 0.5) ]
, graphLabel = Just "disk i/o"
}
log = xmonadLogNew
note = notifyAreaNew defaultNotificationConfig
mpris = mprisNew
mem = pollingGraphNew memCfg 1 memCallback
cpu = cpuMonitorNew cpuCfg 0.5 "cpu"
fs = fsMonitorNew 30 ["/"]
disk = dioMonitorNew diskCfg 1 "sdb"
net = netMonitorNew 1 "enp15s0"
tray = systrayNew
defaultTaffybar defaultTaffybarConfig { startWidgets = [ log, note ]
, endWidgets = [ tray, fs, net, disk, mem, cpu, mpris ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment