[taffybar] Add Multi-monitor config

This commit is contained in:
Ivan Malison 2017-03-04 03:42:30 -08:00
parent d9e0e5802a
commit b22303dd0c
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,10 @@
module Main where module Main where
import Data.Char (toLower) import Data.Char (toLower)
import Text.Read
import Data.List import Data.List
import Data.Maybe
import System.Directory import System.Directory
import System.FilePath.Posix import System.FilePath.Posix
import System.Information.CPU import System.Information.CPU
@ -15,6 +18,7 @@ import System.Taffybar.Systray
import System.Taffybar.TaffyPager import System.Taffybar.TaffyPager
import System.Taffybar.Widgets.PollingGraph import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.WorkspaceHUD import System.Taffybar.WorkspaceHUD
import System.Environment
memCallback = do memCallback = do
mi <- parseMeminfo mi <- parseMeminfo
@ -34,6 +38,8 @@ myGetIconInfo =
windowTitleClassIconGetter False fallbackIcons windowTitleClassIconGetter False fallbackIcons
main = do main = do
monString <- getEnv "TAFFYBAR_MONITOR"
let monitorNumber = fromMaybe 1 $ readMaybe monString
let memCfg = let memCfg =
defaultGraphConfig defaultGraphConfig
{graphDataColors = [(1, 0, 0, 1)], graphLabel = Just "mem"} {graphDataColors = [(1, 0, 0, 1)], graphLabel = Just "mem"}
@ -51,6 +57,7 @@ main = do
hudConfig = hudConfig =
defaultWorkspaceHUDConfig defaultWorkspaceHUDConfig
{ underlineHeight = 3 { underlineHeight = 3
, underlinePadding = 0
, minWSWidgetSize = Nothing , minWSWidgetSize = Nothing
, minIcons = 3 , minIcons = 3
, getIconInfo = myGetIconInfo , getIconInfo = myGetIconInfo
@ -62,6 +69,7 @@ main = do
, updateIconsOnTitleChange = True , updateIconsOnTitleChange = True
, updateOnWMIconChange = True , updateOnWMIconChange = True
, debugMode = True , debugMode = True
, redrawIconsOnStateChange = True
} }
hudPagerConfig = hudFromPagerConfig pagerConfig hudPagerConfig = hudFromPagerConfig pagerConfig
hud = taffyPagerHUDNew pagerConfig hudConfig hud = taffyPagerHUDNew pagerConfig hudConfig
@ -70,7 +78,8 @@ main = do
defaultTaffybarConfig defaultTaffybarConfig
{ startWidgets = [hud] { startWidgets = [hud]
, endWidgets = [tray, clock, mem, cpu, mpris] , endWidgets = [tray, clock, mem, cpu, mpris]
, monitorNumber = 1 , monitorNumber = monitorNumber
, monitorFilter = allMonitors
, barPosition = Top , barPosition = Top
, barHeight = 40 , barHeight = 40
} }

View File

@ -12,6 +12,8 @@ style "taffybar-default" {
color["teal"] = "#80CBC4" color["teal"] = "#80CBC4"
color["bgrey"] = "#37474F" color["bgrey"] = "#37474F"
color["bgreyl"] = "#546E7A" color["bgreyl"] = "#546E7A"
color["activeWS"] = @yellow
color["visibleWS"] = @red
bg[NORMAL] = @dgrey bg[NORMAL] = @dgrey
fg[NORMAL] = @white fg[NORMAL] = @white
@ -22,7 +24,11 @@ style "taffybar-default" {
style "taffybar-active-window" = "taffybar-default" { style "taffybar-active-window" = "taffybar-default" {
bg[NORMAL] = @black bg[NORMAL] = @black
bg[PRELIGHT] = @black
bg[SELECTED] = @black
bg[ACTIVE] = @black
fg[NORMAL] = @yellow fg[NORMAL] = @yellow
text[NORMAL] = @red
} }
style "taffybar-notification-button" = "taffybar-default" { style "taffybar-notification-button" = "taffybar-default" {
@ -34,7 +40,6 @@ style "taffybar-workspace-border-active" = "taffybar-default" {
bg[NORMAL] = @yellow bg[NORMAL] = @yellow
} }
style "taffybar-workspace-border-visible" = "taffybar-default" { style "taffybar-workspace-border-visible" = "taffybar-default" {
bg[NORMAL] = @red bg[NORMAL] = @red
} }
style "taffybar-workspace-border-empty" = "taffybar-default" { style "taffybar-workspace-border-empty" = "taffybar-default" {
@ -60,7 +65,7 @@ style "taffybar-hover-button" = "taffybar-default" {
} }
widget "Taffybar*" style "taffybar-default" widget "Taffybar*" style "taffybar-default"
widget "Taffybar*WindowSwitcher*label" style "taffybar-active-window" widget "Taffybar*WindowSwitcher*" style "taffybar-active-window"
widget "*NotificationCloseButton" style "taffybar-notification-button" widget "*NotificationCloseButton" style "taffybar-notification-button"
widget "*Workspace-underline*-active*" style "taffybar-workspace-border-active" widget "*Workspace-underline*-active*" style "taffybar-workspace-border-active"