[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" | isInfixOf "Kodi" klass = IIFilePath $ resourcesDirectory "kodi.png"
| otherwise = IIColor $ (0xFF, 0xFF, 0, 0xFF) | otherwise = IIColor $ (0xFF, 0xFF, 0, 0xFF)
underlineWidget buildWidget name = do underlineWidget cfg buildWidget name = do
w <- buildWidget w <- buildWidget
t <- T.tableNew 2 1 False t <- T.tableNew 2 1 False
u <- Gtk.eventBoxNew 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 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 T.tableAttach t u 0 1 1 2 [T.Fill] [T.Shrink] 0 0
@ -59,12 +59,12 @@ myGetIconInfo =
windowTitleClassIconGetter False fallbackIcons windowTitleClassIconGetter False fallbackIcons
main = do main = do
monEither <- (try $ getEnv "TAFFYBAR_MONITOR") :: IO (Either SomeException String) monEither <-
(try $ getEnv "TAFFYBAR_MONITOR") :: IO (Either SomeException String)
let monNumber = let monNumber =
case monEither of case monEither of
Left _ -> 0 Left _ -> 0
Right monString -> fromMaybe 0 $ readMaybe monString Right monString -> fromMaybe 0 $ readMaybe monString
let memCfg = let memCfg =
defaultGraphConfig defaultGraphConfig
{graphDataColors = [(1, 0, 0, 1)], graphLabel = Just "mem"} {graphDataColors = [(1, 0, 0, 1)], graphLabel = Just "mem"}
@ -99,10 +99,17 @@ main = do
hudPagerConfig = hudFromPagerConfig pagerConfig hudPagerConfig = hudFromPagerConfig pagerConfig
hud = taffyPagerHUDNew pagerConfig hudConfig hud = taffyPagerHUDNew pagerConfig hudConfig
pager = taffyPagerNew pagerConfig pager = taffyPagerNew pagerConfig
let underline = underlineWidget hudConfig
defaultTaffybar defaultTaffybar
defaultTaffybarConfig defaultTaffybarConfig
{ startWidgets = [hud] { 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 , monitorNumber = monNumber
, monitorFilter = allMonitors , monitorFilter = allMonitors
, barPosition = Top , barPosition = Top

View File

@ -4,6 +4,7 @@ style "taffybar-default" {
color["green"] = "#4caf50" color["green"] = "#4caf50"
color["yellow"] = "#ffeb3b" color["yellow"] = "#ffeb3b"
color["orange"] = "#f4511e"
color["blue"] = "#2196f3" color["blue"] = "#2196f3"
color["red"] = "#E57373" color["red"] = "#E57373"
color["dgrey"] = "#212121" color["dgrey"] = "#212121"
@ -64,6 +65,19 @@ style "taffybar-hover-button" = "taffybar-default" {
text[PRELIGHT] = @yellow 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*" style "taffybar-default"
widget "Taffybar*WindowSwitcher*" style "taffybar-active-window" widget "Taffybar*WindowSwitcher*" style "taffybar-active-window"
widget "*NotificationCloseButton" style "taffybar-notification-button" 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 "*clock-underline*" style "taffybar-workspace-border-active"
widget "*tray-underline*" style "taffybar-workspace-border-hidden" 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"