[taffybar] Update to support toggling

This commit is contained in:
Ivan Malison 2017-03-12 21:25:59 -07:00
parent d773662d44
commit f45e0cf442
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -63,14 +63,13 @@ main = do
(monFilter, monNumber) = (monFilter, monNumber) =
case monEither of case monEither of
Left _ -> (allMonitors, 0) Left _ -> (allMonitors, 0)
Right monString -> case readMaybe monString of Right monString ->
Nothing -> (allMonitors, 0) case readMaybe monString of
Just num -> (Nothing, num) Nothing -> (allMonitors, 0)
Just num -> (Nothing, num)
memCfg = memCfg =
defaultGraphConfig defaultGraphConfig
{ graphDataColors = [(0.129, 0.588, 0.953, 1)] {graphDataColors = [(0.129, 0.588, 0.953, 1)], graphLabel = Just "mem"}
, graphLabel = Just "mem"
}
cpuCfg = cpuCfg =
defaultGraphConfig defaultGraphConfig
{ graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)] { graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)]
@ -81,12 +80,12 @@ main = do
mem = pollingGraphNew memCfg 1 memCallback mem = pollingGraphNew memCfg 1 memCallback
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback cpu = pollingGraphNew cpuCfg 0.5 cpuCallback
tray = do tray = do
tray <- systrayNew tray <- systrayNew
container <- Gtk.eventBoxNew container <- Gtk.eventBoxNew
Gtk.containerAdd container tray Gtk.containerAdd container tray
Gtk.widgetSetName container "Taffytray" Gtk.widgetSetName container "Taffytray"
Gtk.widgetSetName tray "Taffytray" Gtk.widgetSetName tray "Taffytray"
return $ Gtk.toWidget container return $ Gtk.toWidget container
hudConfig = hudConfig =
defaultWorkspaceHUDConfig defaultWorkspaceHUDConfig
{ underlineHeight = 3 { underlineHeight = 3
@ -110,26 +109,28 @@ main = do
pager = taffyPagerNew pagerConfig pager = taffyPagerNew pagerConfig
makeUnderline = underlineWidget hudConfig makeUnderline = underlineWidget hudConfig
pgr <- pagerNew pagerConfig pgr <- pagerNew pagerConfig
let hud = buildWorkspaceHUD hudConfig pgr let hud = buildWorkspaceHUD hudConfig pgr
los = makeUnderline (layoutSwitcherNew pgr) "red" los = makeUnderline (layoutSwitcherNew pgr) "red"
wnd = makeUnderline (windowSwitcherNew pgr) "teal" wnd = makeUnderline (windowSwitcherNew pgr) "teal"
defaultTaffybar taffyConfig =
defaultTaffybarConfig defaultTaffybarConfig
{ startWidgets = [hud, los, wnd] { startWidgets = [hud, los, wnd]
, endWidgets = , endWidgets =
[ makeUnderline tray "yellow" [ makeUnderline tray "yellow"
, makeUnderline clock "teal" , makeUnderline clock "teal"
, makeUnderline mem "blue" , makeUnderline mem "blue"
, makeUnderline cpu "green" , makeUnderline cpu "green"
, makeUnderline mpris "red" , makeUnderline mpris "red"
] ]
, monitorNumber = monNumber , monitorNumber = monNumber
, monitorFilter = monFilter , getMonitorConfig = monFilter
, barPosition = Top , barPosition = Top
, barHeight = 50 , barHeight = 50
, widgetSpacing = 5 , widgetSpacing = 5
} }
defaultTaffybar taffyConfig
-- Local Variables: -- Local Variables:
-- flycheck-ghc-args: ("-Wno-missing-signatures") -- flycheck-ghc-args: ("-Wno-missing-signatures")