[taffybar] Add underlines

This commit is contained in:
Ivan Malison 2017-03-04 13:13:03 -08:00
parent 88beaa9ad5
commit df15dacf8e
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 31 additions and 5 deletions

View File

@ -39,12 +39,12 @@ fallbackIcons _ klass
| isInfixOf "Kodi" klass = IIFilePath $ resourcesDirectory "kodi.png"
| otherwise = IIColor $ (0xFF, 0xFF, 0, 0xFF)
underlineWidget buildWidget name = do
underlineWidget cfg buildWidget name = do
w <- buildWidget
t <- T.tableNew 2 1 False
u <- Gtk.eventBoxNew
W.widgetSetSizeRequest u (-1) $ 2
W.widgetSetSizeRequest u (-1) $ underlineHeight cfg
T.tableAttach t w 0 1 0 1 [T.Expand] [T.Expand] 0 0
T.tableAttach t u 0 1 1 2 [T.Fill] [T.Shrink] 0 0
@ -59,12 +59,12 @@ myGetIconInfo =
windowTitleClassIconGetter False fallbackIcons
main = do
monEither <- (try $ getEnv "TAFFYBAR_MONITOR") :: IO (Either SomeException String)
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,10 +99,17 @@ main = do
hudPagerConfig = hudFromPagerConfig pagerConfig
hud = taffyPagerHUDNew pagerConfig hudConfig
pager = taffyPagerNew pagerConfig
let underline = underlineWidget hudConfig
defaultTaffybar
defaultTaffybarConfig
{ startWidgets = [hud]
, endWidgets = [underlineWidget tray "tray", underlineWidget clock "clock", mem, cpu, mpris]
, endWidgets =
[ underline tray "yellow"
, underline clock "blue"
, underline mem "orange"
, underline cpu "green"
, underline mpris "red"
]
, monitorNumber = monNumber
, monitorFilter = allMonitors
, barPosition = Top

View File

@ -4,6 +4,7 @@ style "taffybar-default" {
color["green"] = "#4caf50"
color["yellow"] = "#ffeb3b"
color["orange"] = "#f4511e"
color["blue"] = "#2196f3"
color["red"] = "#E57373"
color["dgrey"] = "#212121"
@ -64,6 +65,19 @@ style "taffybar-hover-button" = "taffybar-default" {
text[PRELIGHT] = @yellow
}
style "blue" = "taffybar-default" {
bg[NORMAL]= @blue
}
style "orange" = "taffybar-default" {
bg[NORMAL]= @orange
}
style "red" = "taffybar-default" {
bg[NORMAL]= @red
}
style "yellow" = "taffybar-default" {
bg[NORMAL]= @yellow
}
widget "Taffybar*" style "taffybar-default"
widget "Taffybar*WindowSwitcher*" style "taffybar-active-window"
widget "*NotificationCloseButton" style "taffybar-notification-button"
@ -87,3 +101,8 @@ widget "*WorkspaceHUD-*" style "taffybar-hover-button"
widget "*clock-underline*" style "taffybar-workspace-border-active"
widget "*tray-underline*" style "taffybar-workspace-border-hidden"
widget "*blue-underline*" style "blue"
widget "*red-underline*" style "red"
widget "*yellow-underline*" style "yellow"
widget "*orange-underline*" style "orange"
widget "*green-underline*" style "green"