[taffybar] Use sequence for swapping IO and Maybe

This commit is contained in:
Ivan Malison 2017-09-12 11:00:28 -07:00
parent 54df1e5d41
commit 23ff653304
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -125,8 +125,6 @@ getInterfaces = do
(_, output, _) <- readCreateProcessWithExitCode (shell "list_interfaces.sh") "" (_, output, _) <- readCreateProcessWithExitCode (shell "list_interfaces.sh") ""
return $ splitOn "\n" output return $ splitOn "\n" output
swapMaybeIO = maybe (return Nothing) (Just <$>)
main = do main = do
monEither <- monEither <-
(try $ getEnv "TAFFYBAR_MONITOR") :: IO (Either SomeException String) (try $ getEnv "TAFFYBAR_MONITOR") :: IO (Either SomeException String)
@ -149,7 +147,7 @@ main = do
cfg <- asks hudConfig cfg <- asks hudConfig
lift $ do lift $ do
img <- Gtk.imageNew img <- Gtk.imageNew
pb <- swapMaybeIO $ getWorkspacePixBuf (windowIconSize cfg) ws pb <- sequence $ getWorkspacePixBuf (windowIconSize cfg) ws
setImage (windowIconSize cfg) img pb setImage (windowIconSize cfg) img pb
return $ WWC ConstantIconController { cicImage = img } return $ WWC ConstantIconController { cicImage = img }
makeIcon = return . IIFilePath . inResourcesDirectory makeIcon = return . IIFilePath . inResourcesDirectory