greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.88k stars 475 forks source link

Add test command for all blocks? #1326

Closed ammgws closed 2 years ago

ammgws commented 3 years ago

Just used my laptop for the first time in ages and remembered the below discussion from a while back. I feel like it would be a pretty handy feature when you are sharing the same config between multiple machines:

I'm also sharing the configuration between multiple computers and was bitten by this issue.

I have another suggestion, what do you think about adding a tag for all blocks for a test command? E.g.:

[[block]]
block = "battery"
if_command = "upower -e"

If the command upower -e exits with an error code, the block will not be rendered.

Originally posted by @jlesquembre in https://github.com/greshake/i3status-rust/issues/50#issuecomment-362104891

MaxVerevkin commented 3 years ago

So the idea is to run a command once before block's initialization and skip it if the exit code is nonzero?

ammgws commented 3 years ago

Pretty much. What do you think?

MaxVerevkin commented 3 years ago

It's pretty easy to implement, so why not?

ammgws commented 3 years ago

Yeah sure, I just read too much into your comment and thought you were going to critique it