[taffybar] Add a fallback icon when none can be found

This commit is contained in:
Ivan Malison 2017-09-10 18:20:04 -07:00
parent 8c9be14388
commit f48ce23c89
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 12 additions and 12 deletions

View File

@ -126,16 +126,20 @@ main = do
homeDirectory <- getHomeDirectory homeDirectory <- getHomeDirectory
let resourcesDirectory = homeDirectory </> ".lib" </> "resources" let resourcesDirectory = homeDirectory </> ".lib" </> "resources"
inResourcesDirectory file = resourcesDirectory </> file inResourcesDirectory file = resourcesDirectory </> file
makeIcon = IIFilePath . inResourcesDirectory makeIcon = return . IIFilePath . inResourcesDirectory
myCustomIcon title klass myGetIconInfo w@WindowData {windowTitle = title, windowClass = klass}
| "URxvt" `isInfixOf` klass = makeIcon "urxvt.png" | "URxvt" `isInfixOf` klass = makeIcon "urxvt.png"
| "Termite" `isInfixOf` klass = makeIcon "urxvt.png" | "Termite" `isInfixOf` klass = makeIcon "urxvt.png"
| "Kodi" `isInfixOf` klass = makeIcon "kodi.png" | "Kodi" `isInfixOf` klass = makeIcon "kodi.png"
| "@gmail.com" `isInfixOf` title && | "@gmail.com" `isInfixOf` title &&
"chrome" `isInfixOf` klass && "chrome" `isInfixOf` klass && "Gmail" `isInfixOf` title =
"Gmail" `isInfixOf` title = makeIcon "gmail.png" makeIcon "gmail.png"
| otherwise = IINone | otherwise = do
myGetIconInfo = windowTitleClassIconGetter True myCustomIcon res <- defaultGetIconInfo w
return $
case res of
IINone -> IIFilePath $ inResourcesDirectory "exe-icon.png"
_ -> res
(_, monNumber) = (_, monNumber) =
case monEither of case monEither of
Left _ -> (allMonitors, 0) Left _ -> (allMonitors, 0)
@ -182,14 +186,11 @@ main = do
netMonitor = netMonitorMultiNew 1.5 interfaceNames netMonitor = netMonitorMultiNew 1.5 interfaceNames
pagerConfig = pagerConfig =
defaultPagerConfig defaultPagerConfig
{ useImages = True {useImages = True, windowSwitcherFormatter = myFormatEntry}
, windowSwitcherFormatter = myFormatEntry
}
-- pager = taffyPagerNew pagerConfig -- pager = taffyPagerNew pagerConfig
makeUnderline = underlineWidget hudConfig makeUnderline = underlineWidget hudConfig
pgr <- pagerNew pagerConfig pgr <- pagerNew pagerConfig
tray2 <- movableWidget tray tray2 <- movableWidget tray
let hud = buildWorkspaceHUD hudConfig pgr let hud = buildWorkspaceHUD hudConfig pgr
los = makeUnderline (layoutSwitcherNew pgr) "red" los = makeUnderline (layoutSwitcherNew pgr) "red"
wnd = makeUnderline (windowSwitcherNew pgr) "teal" wnd = makeUnderline (windowSwitcherNew pgr) "teal"
@ -209,7 +210,6 @@ main = do
, barHeight = 50 , barHeight = 50
, widgetSpacing = 5 , widgetSpacing = 5
} }
withToggleSupport taffyConfig withToggleSupport taffyConfig
-- Local Variables: -- Local Variables:

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB