-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create block to display external IP address information #1366
Conversation
This should probably be mentioned in the docs. |
Added. |
This addition doesn't look NetworkManager-specific, so perhaps it could be added to # County flag
[[block]]
block = "custom"
command = """curl -s http://ip-api.com/json | jq -r '.countryCode' | python -c 'print("".join(map(lambda x: chr(ord(x)+127397),input())))'"""
interval = 60
# County code
[[block]]
block = "custom"
command = """curl -s http://ip-api.com/json | jq -r '.countryCode'"""
interval = 60
# Address
[[block]]
block = "custom"
command = """curl -s http://ip-api.com/json | jq -r '.query'"""
interval = 60 |
The net block doesn't have the very useful DBus listener stuff to detect changes as they happen. I actually started adding it there but it was clearly going in the wrong direction. I could create a separate block just for this (which would be a copy of this one minus part of the preexisting stuff), but I'm not sure that's also a good idea.
First - I personally refuse to be spawning processing every X seconds to populate the bar, if I wanted that I would be using the old bar which has a trillion of those scripts :-) Second, with a custom block you won't be able to immediately react to changes anyway. |
I've built my own block with blackjack and hookers. |
a522fb2
to
68edb86
Compare
68edb86
to
34d2e43
Compare
Why not use |
Because I wasn't aware of it :-) |
@MaxVerevkin I've switched to that one. It's missing the ISP though, which is somewhat valuable, but I prefer having https over that specific field. |
Also I think NetworkManager thread should be optional (perhaps on by default?) because this block can be useful for non NetworkManager users too. |
I've added that.
I'd expect one poll every minute, and that's not happening (I'm monitoring traffic with wireshark). |
It appears that |
How do you know for sure? |
I've put an |
OK, can't argue with that :-) |
There are clippy warnings, but apart from that, looks good to me. |
Fixed. |
Thanks! By the way, if you want to tinker with some async rust code, you can port this block overt to async version which will hopefully be merged at some point (#1369) :) |
Display our external IP address and information about it (country, region, location, ISP, etc).
-Tested with IPv4 only.