[taffybar] Add underlines to a few more widgets

This commit is contained in:
Ivan Malison 2017-03-04 03:59:38 -08:00
parent c6405fe151
commit 6d48eb51cf
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 42 additions and 19 deletions

View File

@ -2,10 +2,13 @@ module Main where
import Data.Char (toLower)
import Text.Read
import Data.List
import Data.Maybe
import qualified Graphics.UI.Gtk as Gtk
import qualified Graphics.UI.Gtk.Abstract.Widget as W
import qualified Graphics.UI.Gtk.Layout.Table as T
import System.Directory
import System.Environment
import System.FilePath.Posix
import System.Information.CPU
import System.Information.Memory
@ -18,7 +21,8 @@ import System.Taffybar.Systray
import System.Taffybar.TaffyPager
import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.WorkspaceHUD
import System.Environment
import Text.Printf
import Text.Read
memCallback = do
mi <- parseMeminfo
@ -35,6 +39,22 @@ fallbackIcons _ klass
| isInfixOf "Kodi" klass = IIFilePath $ resourcesDirectory "kodi.png"
| otherwise = IIColor $ (0xFF, 0xFF, 0, 0xFF)
underlineWidget buildWidget name = do
w <- buildWidget
t <- T.tableNew 2 1 False
u <- Gtk.eventBoxNew
W.widgetSetSizeRequest u (-1) $ 2
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
Gtk.widgetSetName u $ (printf "%s-underline" name :: String)
Gtk.widgetShowAll t
return $ Gtk.toWidget t
myGetIconInfo =
windowTitleClassIconGetter False fallbackIcons
@ -78,7 +98,7 @@ main = do
defaultTaffybar
defaultTaffybarConfig
{ startWidgets = [hud]
, endWidgets = [tray, clock, mem, cpu, mpris]
, endWidgets = [underlineWidget tray "tray", underlineWidget clock "clock", mem, cpu, mpris]
, monitorNumber = monitorNumber
, monitorFilter = allMonitors
, barPosition = Top

View File

@ -84,3 +84,6 @@ widget "*Workspace-icon*-urgent*" style "taffybar-icon-urgent"
widget "*WorkspaceHUD-*" style "taffybar-hover-button"
widget "*WorkspaceHUD-*" style "taffybar-hover-button"
widget "*clock-underline*" style "taffybar-workspace-border-active"
widget "*tray-underline*" style "taffybar-workspace-border-hidden"