ultrabug / py3status

py3status is an extensible i3status wrapper written in python

Home Page:https://ultrabug.github.io/py3status/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

net_rate module shows after disconnecting network

b3nsh4 opened this issue · comments

Py3status version: py3status version 3.45 (python 3.10.5) on i3
I've been noticing something so recently that, after disconnecting the network, the net_rate module stays unless i fully refresh the i3wm, the module does not disappear. Of course i could make the module disappear when there is no activity. But just asking a way to make it disappear on sending a signal something as py3-cmd refresh net_rate

image

We need your config too.

The module may not appear at first... not because there is no internet activity, but because the placeholder could have been empty at first and the py3status formatter by default will hide. This is true for all "empty placeholder(s)" modules.

However, I think in this case, the module have format_no_connection that was probably displayed when you restart i3wm with no network activities. Otherwise, the placeholder will keep showing format_value even if it's a zero.

Pay attention to this specific wording start of the plugin.

format_no_connection: when there is no data transmitted from the start of the plugin (default '')

It sounds like you want this module to disappear with 0 value too... so I'd try something like...

format_value = "[\?if=value [\?min_length=10 {value:.1f} {unit}]]"

There's also a hide_if_zero = True config you should try first too.

Hey thanks for the reply. Yes i have tried hide_if_zero = True and i personally did not have it because most of the times, i go idle, that does not mean the data is not using. There could be some bytes going and coming so do the hide does not effectively work. I use i3blocks too. So, i'm sending a signal to blocks when i hit the wifiOFF button and blocks get updated. I'm trying to send the same to py3status net-rate module. By the way, there is my full config. Thanks for the help.

#general {
#        colors = true
#        interval = 10
#}




order += "net_rate"
order += "external_script"
order += "sysdata"
order += "diskdata"

sysdata {
 	format=" {mem_used_percent}%  "
  cache_timeout = 60
}


diskdata {
	
	format="🖸{read} {write} "
  cache_timeout = 30
}

net_rate {
	format="⬇️{down}{up} ⬆️"
  cache_timeout = 10
#  hide_if_zero = True

}
py3status {
   align = 'left'
   markup = 'pango'
   min_width = 20
   separator = True
   separator_block_width = 9

   background = '#285577'
   border = '#4c7899'
   border_bottom = 1
   border_left = 1
   border_right = 1
   border_top = 1

   min_length = 15
   position = 'right'
}
rainbow time {
    time {}
}

external_script {
  format = "Playing 🎵: {output}"
  script_path="/home/ben/.scripts/musik"
  cache_timeout=30
}

To take advantage of py3status formatter, this module requires to be rewritten so you could have icons on either side.

This is probably the best clone config I can come up with.

order += "net_rate"
net_rate {
    format = "[⬇️ {down}][\?soft  ][⬆️ {up}]"
    format_value  = "\?if=value {value:.1f} {unit}"
    cache_timeout = 10
}

... should produce ⬇️ 152.0 B/s ⬆️ 0.1 B/s along with disappearing format_value.

The changed format would look something like this to include icons on either side.

format = "[\?if=download ⬇️ {download} {download_unit}[\?soft ][\?if=upload {upload} {upload_unit} ⬆️]"

This is it. i missed the format_value. Infact this is the same as hide_if_zero = True which is again not i was looking for.
ThankYou @lasers