Created
November 8, 2015 14:33
-
-
Save arnsholt/febd08ef28cc0e97744b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.UI.Gtk as Gtk | |
import System.Taffybar | |
import System.Taffybar.Battery | |
import System.Taffybar.NetMonitor | |
import System.Taffybar.SimpleClock | |
import System.Taffybar.Systray | |
import System.Taffybar.Pager | |
import System.Taffybar.TaffyPager | |
import System.Taffybar.Widgets.PollingGraph | |
import System.Taffybar.Widgets.PollingLabel | |
import System.Information.CPU | |
import System.Information.Memory | |
cpuCallback = do | |
(_, systemLoad, totalLoad) <- cpuLoad | |
return [ totalLoad, systemLoad ] | |
-- With code liberally snarfed from System.Taffybar.Text.MemoryMonitor: | |
mem = do | |
label <- pollingLabelNew "Mem" 0.5 callback | |
Gtk.widgetShowAll label | |
return label | |
where | |
callback = do | |
info <- parseMeminfo | |
return $ "Mem: " ++ (show . truncate $ 100*memoryUsedRatio info) ++ "%" | |
-- xmobar widgets: XMonad crap || network | cpu | memory | battery | time | |
main = do | |
let cpuCfg = defaultGraphConfig { graphDataColors = [ (0, 1, 0, 1), (1, 0, 1, 0.5)] | |
, graphLabel = Nothing | |
} | |
batt = batteryBarNew defaultBatteryConfig 0.5 | |
clock = textClockNew Nothing "%A %B %d, %Y" 1 | |
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback | |
log = taffyPagerNew $ defaultPagerConfig { activeWorkspace = wrap "[" "]" . escape | |
, emptyWorkspace = \_ -> "" | |
, activeWindow = shorten 100 | |
, widgetSep = " | " | |
} | |
net = netMonitorNew 0.5 "wlan0" | |
tray = systrayNew | |
defaultTaffybar defaultTaffybarConfig { startWidgets = [log] | |
, endWidgets = reverse [net, cpu, mem, batt, clock, tray] | |
, barHeight = 20 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment