greshake / i3status-rust

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

Add a way to trigger refresh of the bar #1979

Closed quite closed 6 months ago

quite commented 6 months ago

It would be nice if there was some way to trigger an immediate refresh of the bar (or block). Imagine a custom block which shows something, with a click action that changes the state of that something. Refreshing the bar or block immediately would be nice, while still keeping the same default refresh interval (seconds).

MaxVerevkin commented 6 months ago

There already is :) You can update the entire bar with SIGUSR1 signal (mentioned in the readme). Also, each block has a signal = n property (mentioned here) which lets you update a specific block using SIGRTMIN+n.

Imagine a custom block which shows something, with a click action that changes the state of that something

In this specific case, you can set update = true in your click handler to update the block when clicking. If the output depends on the changed state, also set sync = true:

[[block.click]]
button = "left"
update = true
sync = true
cmd = "..."
quite commented 6 months ago

Oh, thanks a lot. I found it in the README now. Sorry for the noise.