diff --git a/src/QBar/Blocks/Script.hs b/src/QBar/Blocks/Script.hs index 4e9b8bab42b33681f4c7cb32d43f4c3d89e84f11..8dcf0faecf6890eb4ed4e83be2c62e51074dda6a 100644 --- a/src/QBar/Blocks/Script.hs +++ b/src/QBar/Blocks/Script.hs @@ -26,11 +26,11 @@ scriptBlock path = forever $ updateBlock =<< (lift blockScriptAction) -- I am trying to replace i3blocks scripts with native haskell blocks, so I do not need it (exitCode, output) <- liftIO $ readProcessStdout $ shell path return $ case exitCode of - ExitSuccess -> createScriptBlock output + ExitSuccess -> createScriptBlockOutput output (ExitFailure nr) -> case nr of _ -> mkErrorOutput $ "exit code " <> T.pack (show nr) <> "" - createScriptBlock :: C8.ByteString -> BlockOutput - createScriptBlock output = case map E.decodeUtf8 (C8.lines output) of + createScriptBlockOutput :: C8.ByteString -> BlockOutput + createScriptBlockOutput output = case map E.decodeUtf8 (C8.lines output) of (text:short:_) -> parseTags'' text short (text:_) -> parseTags' text [] -> emptyBlock diff --git a/src/QBar/Cli.hs b/src/QBar/Cli.hs index 7e4eeab325ccb8314d6a0978b7b0b6438b491394..702c8a30917cdf42f2a1872b87f417702c95f970 100644 --- a/src/QBar/Cli.hs +++ b/src/QBar/Cli.hs @@ -85,4 +85,4 @@ scriptBlockParser :: Parser (BarIO ()) scriptBlockParser = helper <*> do persistent <- switch $ long "persistent" <> short 'p' <> help "Run script in persistent mode (every line of output updates the block)." script <- strArgument (metavar "SCRIPT" <> help "The script that will be executed with a shell.") - return $ (if persistent then addBlock . scriptBlock else addBlock . persistentScriptBlock) script + return $ (if persistent then addBlock . persistentScriptBlock else addBlock . scriptBlock) script