greshake / i3status-rust

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

net: revise `is_up()` logic #1903

Closed MaxVerevkin closed 1 year ago

MaxVerevkin commented 1 year ago

Fixes #1866. Fixes #1895.

okhsunrog commented 1 year ago

Tested today, works without any issues now

okhsunrog commented 1 year ago

when this pr will be merged?

MaxVerevkin commented 1 year ago

when this pr will be merged?

I will probably wait for a few more people to test this to confirm it does not break anything.

muellerjoel commented 1 year ago

I tested following way

yay -R i3status-rust-git

git clone https://aur.archlinux.org/i3status-rust-full-git.git
cd i3status-rust-full-git
vim PKGUBILD
#add
prepare() {
cd "${shortname}"
git checkout -b 1903
}
makepgkg -si

Reboot

``` # .config/i3status-rust/config.toml icons_format = "{icon}" [theme] theme = "solarized-dark" [theme.overrides] idle_bg = "#123456" idle_fg = "#abcdef" [icons] icons = "none" [icons.overrides] bat = " | | " bat_full = " |X| " bat_charging = " |^| " bat_discharging = " |v| " [[block]] block = "cpu" [[block]] block = "disk_space" path = "/" info_type = "available" alert_unit = "GB" interval = 20 warning = 20.0 alert = 10.0 format = " $icon root: $available.eng(w:2) " [[block]] block = "disk_space" path = "/home" info_type = "available" alert_unit = "GB" interval = 20 warning = 20.0 alert = 10.0 format = " $icon home: $available.eng(w:2) " [[block]] block = "disk_space" path = "/home/backup" info_type = "available" alert_unit = "GB" interval = 20 warning = 20.0 alert = 10.0 format = " $icon backup: $available.eng(w:2) " [[block]] block = "memory" format = " $icon $mem_total_used_percents.eng(w:2) " format_alt = " $icon_swap $swap_used_percents.eng(w:2) " [[block]] block = "net" device = "wlp0s20f3" format = " $icon {$signal_strength $ssid $frequency} via $device IPv4: $ip UP: $speed_up DOWN: $speed_down" inactive_format = "No Wireless" interval = 1 [[block]] block = "net" device = "enp58s0u2u3c2" format = " $icon $device IPv4: $ip UP: $speed_up DOWN: $speed_down" inactive_format = "No Ethernet" interval = 1 [[block]] block = "time" interval = 5 format = " $timestamp.datetime(f:'%a %d/%m %R') " [[block]] block = "sound" [[block.click]] button = "left" cmd = "pavucontrol" [[block]] block = "bluetooth" mac = "80:C3:BA:29:FE:97" disconnected_format = " $icon NO DEVICE" format = " $icon MOMENTUM4" [block.battery_state] "0..20" = "critical" "21..70" = "warning" "71..100" = "good" ``` ``` [morta@lapt0p ~]$ ip a 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s31f6: mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 48:2a:e3:4c:13:ef brd ff:ff:ff:ff:ff:ff 3: wlp0s20f3: mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 1e:4f:c7:84:84:4c brd ff:ff:ff:ff:ff:ff permaddr 84:fd:d1:fd:30:36 4: vmnet1: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff inet 192.168.193.1/24 brd 192.168.193.255 scope global vmnet1 valid_lft forever preferred_lft forever inet6 fe80::250:56ff:fec0:1/64 scope link valid_lft forever preferred_lft forever 5: vmnet8: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff inet 192.168.130.1/24 brd 192.168.130.255 scope global vmnet8 valid_lft forever preferred_lft forever inet6 fe80::250:56ff:fec0:8/64 scope link valid_lft forever preferred_lft forever 6: enp58s0u2u3c2: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 link/ether 80:6d:97:0d:ed:b9 brd ff:ff:ff:ff:ff:ff inet 192.168.1.106/24 brd 192.168.1.255 scope global dynamic noprefixroute enp58s0u2u3c2 valid_lft 6382sec preferred_lft 6382sec inet6 2a02:XXX:a774:0:9289:1098:f602:28c7/64 scope global dynamic noprefixroute valid_lft 86332sec preferred_lft 14332sec inet6 fe80::8e5b:611:4560:4324/64 scope link noprefixroute valid_lft forever preferred_lft forever 7: anbox0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000 link/ether 3a:53:f0:b3:df:12 brd ff:ff:ff:ff:ff:ff inet 192.168.250.1/24 brd 192.168.250.255 scope global noprefixroute anbox0 valid_lft forever preferred_lft forever ```

And is not working

muellerjoel commented 1 year ago

20230518_14h42m56s_grim

MaxVerevkin commented 1 year ago

@muellerjoel

git checkout -b 1903

You just create a new branch from the master. Try git checkout net_next.

BTW, there is no need to post the entire config. Or you can use <details></details> to make it collapse-able.

muellerjoel commented 1 year ago

Ok is now working!

20230518_15h01m08s_grim

muellerjoel commented 1 year ago

What is the difference between a new branch and without?

PS: Excellent work! Thanks...

MaxVerevkin commented 1 year ago

What is the difference between a new branch and without?

git checkout -b creates a new branch. In this case you effectively still use master. git checkout ... switches to a different branch, in this case the branch from this PR.