forked from colonelpanic/dotfiles
[taffybar] Add a fallback icon when none can be found
This commit is contained in:
parent
8c9be14388
commit
f48ce23c89
@ -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:
|
||||||
|
BIN
dotfiles/lib/resources/exe-icon.png
Normal file
BIN
dotfiles/lib/resources/exe-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 KiB |
Loading…
Reference in New Issue
Block a user