Skip to content
Snippets Groups Projects
Commit 70452c0f authored by Jens Nolte's avatar Jens Nolte
Browse files

Add update indicator option (--indicator|-i)

parent 31dad3e0
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ barCommandParser = hsubparser
data MainOptions = MainOptions {
verbose :: Bool,
indicator :: Bool,
socketLocation :: Maybe T.Text,
barCommand :: BarCommand
}
......@@ -23,9 +24,10 @@ data MainOptions = MainOptions {
mainOptionsParser :: Parser MainOptions
mainOptionsParser = do
verbose <- switch $ long "verbose" <> short 'v' <> help "Print more diagnostic output to stderr (including a copy of every bar update)."
indicator <- switch $ long "indicator" <> short 'i' <> help "Show render indicator."
socketLocation <- optional $ strOption $ long "socket" <> short 's' <> metavar "SOCKET" <> help "Control socket location. By default determined by WAYLAND_SOCKET location."
barCommand <- barCommandParser
return MainOptions {verbose, socketLocation, barCommand}
return MainOptions {verbose, indicator, socketLocation, barCommand}
parser :: ParserInfo MainOptions
parser = info (mainOptionsParser <**> helper)
......
......@@ -172,7 +172,7 @@ runBarConfiguration generateBarConfig options = do
let initialBlocks = [date]
-- Attach spinner indicator when verbose flag is set
let initialBlocks' = if verbose options then initialBlocks <> [createBlock "*"] else initialBlocks
let initialBlocks' = if indicator options then initialBlocks <> [createBlock "*"] else initialBlocks
-- Render initial time block so the bar is not empty after startup
initialOutput <- renderLine options handle initialBlockFilter initialBlocks' ""
......@@ -182,7 +182,7 @@ runBarConfiguration generateBarConfig options = do
blockProducers <- generateBarConfig barUpdateChannel
-- Attach spinner indicator when verbose flag is set
let blockProducers' = if verbose options then blockProducers <> [renderIndicator] else blockProducers
let blockProducers' = if indicator options then (renderIndicator:blockProducers) else blockProducers
-- Create channel to send new block producers to render loop
newBlockProducers <- newTChanIO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment