Skip to content

Commit

Permalink
Fixes crash when no CSS file exists
Browse files Browse the repository at this point in the history
Closes #247
  • Loading branch information
phuhl committed Jan 4, 2024
1 parent 6e330be commit 4826d26
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/NotificationCenter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,15 @@ deleteInCenter tState = do
setWindowStyle tState = do
state <- readTVarIO tState
homeDir <- getXdgDirectory XdgConfig ""
let paths = [homeDir ++ "/deadd/deadd.css", "/etc/xdg/deadd/deadd.css"]
style <- readFile =<< (filterM doesFileExist paths >>= return . head)
screen <- windowGetScreen $ stMainWindow state
setStyle screen $ BS.pack $ style
paths <- filterM doesFileExist
$ [homeDir ++ "/deadd/deadd.css", "/etc/xdg/deadd/deadd.css"]
>>= return
if length paths > 0 then do
style <- readFile =<< (filterM doesFileExist paths >>= return . head)
screen <- windowGetScreen $ stMainWindow state
setStyle screen $ BS.pack $ style
else
return ()

createNotiCenter :: TVar State -> Config -> Catalog -> IO ()
createNotiCenter tState config catalog = do
Expand Down

0 comments on commit 4826d26

Please sign in to comment.