[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

@ -1,24 +1,28 @@
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 Data.Maybe import qualified Graphics.UI.Gtk as Gtk
import System.Directory import qualified Graphics.UI.Gtk.Abstract.Widget as W
import System.FilePath.Posix import qualified Graphics.UI.Gtk.Layout.Table as T
import System.Information.CPU import System.Directory
import System.Information.Memory import System.Environment
import System.Taffybar import System.FilePath.Posix
import System.Taffybar.IconImages import System.Information.CPU
import System.Taffybar.MPRIS2 import System.Information.Memory
import System.Taffybar.Pager import System.Taffybar
import System.Taffybar.SimpleClock import System.Taffybar.IconImages
import System.Taffybar.Systray import System.Taffybar.MPRIS2
import System.Taffybar.TaffyPager import System.Taffybar.Pager
import System.Taffybar.Widgets.PollingGraph import System.Taffybar.SimpleClock
import System.Taffybar.WorkspaceHUD import System.Taffybar.Systray
import System.Environment import System.Taffybar.TaffyPager
import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.WorkspaceHUD
import Text.Printf
import Text.Read
memCallback = do memCallback = do
mi <- parseMeminfo mi <- parseMeminfo
@ -35,6 +39,22 @@ 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
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 = myGetIconInfo =
windowTitleClassIconGetter False fallbackIcons windowTitleClassIconGetter False fallbackIcons
@ -78,7 +98,7 @@ main = do
defaultTaffybar defaultTaffybar
defaultTaffybarConfig defaultTaffybarConfig
{ startWidgets = [hud] { startWidgets = [hud]
, endWidgets = [tray, clock, mem, cpu, mpris] , endWidgets = [underlineWidget tray "tray", underlineWidget clock "clock", mem, cpu, mpris]
, monitorNumber = monitorNumber , monitorNumber = monitorNumber
, monitorFilter = allMonitors , monitorFilter = allMonitors
, barPosition = Top , 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 "*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"