forked from colonelpanic/dotfiles
		
	[taffybar] Add underlines to a few more widgets
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user