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

Recover from "Failed to render full text" #1838

Closed meithecatte closed 1 year ago

meithecatte commented 1 year ago

From time to time, the net block of my status line gets stuck in

Error in net: Failed to render full text. (Cause: Placeholder 'ip' not found)

This persists until I restart i3status with a sway config reload.

ammgws commented 1 year ago

What's your config for the net block?

meithecatte commented 1 year ago

I am using the following config:

[[block]]
block = "net"
device = "wlan0"
format = "$icon $ssid $signal_strength $ip $speed_down/s $graph_down"
interval = 5
MaxVerevkin commented 1 year ago

$ip is not guaranteed to be always available (we should add a note in the docs...), so you have to explicitly handle that case, for example

format = "$icon $ssid $signal_strength {$ip|N/A} $speed_down/s $graph_down"

or

format = "$icon $ssid $signal_strength {$ip |}$speed_down/s $graph_down"
meithecatte commented 1 year ago

Okay, but this shouldn't break the rendering forever, just for the time period where the IP isn't available.

ammgws commented 1 year ago

Did you try it? That's exactly what that pipe syntax is for :) Actually it's better - it doesnt break rendering at all

meithecatte commented 1 year ago

Even if the configuration doesn't handle a case, encountering the case for 1 second shouldn't break rendering forever. i3status-rs should recover once the network card gets assigned an IP address again.

equalis3r commented 1 year ago

Even if the configuration doesn't handle a case, encountering the case for 1 second shouldn't break rendering forever. i3status-rs should recover once the network card gets assigned an IP address again.

I totally agree with you. Since the release of [i3status-rust 0.30.0], this happens. The provided solution doesn't address the issue.

The issue is not about how user should handle the case of no IP address. The issue is when the IP address is reacquired, i3status-rust does not recover without a manual reload. This is extremely common case since letting your PC suspends will cause IP to drop and when it is resumed, the IP is acquired but rendering is still broken.

MaxVerevkin commented 1 year ago

PRs to implement this in a generic manner (not net specific) welcomed.

nsirolli commented 1 year ago

Same issue here with the music block, using the mpd player.

w-jablonski commented 6 months ago

For anyone interested, the $signal_strength is also not always available for me. And that when that network is up. Using SwayWM and happening (exclusively?) after system hibernation.