-
-
Notifications
You must be signed in to change notification settings - Fork 717
Description
Is your feature request related to a problem? Please describe.
I would love to be able to configure a script module to use different formatting and foreground/background colors if a command/script fails i.e. returns an exit code other than 0.
Why does polybar need this feature?
Well, I figured being able to use different formatting and colors for a failed command (e.g. background turns bright red if a command specified in exec =
returns a non-zero exit code) would be a very welcome feature as it increases visibility, I suppose.
Describe the solution you'd like
I'm thinking of something like so:
format-success-prefix =
format-success-suffix =
format-success-foreground =
format-success-background =
format-failure-prefix =
format-failure-suffix =
format-failure-foreground =
format-failure-background =
So for example if the command I run in exec =
succeeds, then the output will be shown with the formatting specified by the format-success-*
configurations. Likewise if the command fails, then format-failure-*
will be used to format the output on the bar.
Describe alternatives you've considered
As dumb as it sounds, I have tried putting exec = tput setaf 1; echo "Hello"
in the script module. I was totally surprised to find out that it didn't work. I could not think of other alternatives, honestly, but I might not have RTFM-ed enough.