[taffybar] Set a default monitor

This commit is contained in:
Ivan Malison 2017-03-04 12:03:10 -08:00
parent 6d48eb51cf
commit 88beaa9ad5
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1,7 +1,7 @@
module Main where
import Control.Exception.Base
import Data.Char (toLower)
import Data.List
import Data.Maybe
import qualified Graphics.UI.Gtk as Gtk
@ -59,8 +59,12 @@ myGetIconInfo =
windowTitleClassIconGetter False fallbackIcons
main = do
monString <- getEnv "TAFFYBAR_MONITOR"
let monitorNumber = fromMaybe 1 $ readMaybe monString
monEither <- (try $ getEnv "TAFFYBAR_MONITOR") :: IO (Either SomeException String)
let monNumber =
case monEither of
Left _ -> 0
Right monString -> fromMaybe 0 $ readMaybe monString
let memCfg =
defaultGraphConfig
{graphDataColors = [(1, 0, 0, 1)], graphLabel = Just "mem"}
@ -99,7 +103,7 @@ main = do
defaultTaffybarConfig
{ startWidgets = [hud]
, endWidgets = [underlineWidget tray "tray", underlineWidget clock "clock", mem, cpu, mpris]
, monitorNumber = monitorNumber
, monitorNumber = monNumber
, monitorFilter = allMonitors
, barPosition = Top
, barHeight = 40