diff options
author | justanothercatgirl <sotov2070@gmail.com> | 2024-05-21 18:10:21 +0300 |
---|---|---|
committer | justanothercatgirl <sotov2070@gmail.com> | 2024-05-21 18:10:21 +0300 |
commit | b2b543355c03ec24281d05380f92e2e793e511f4 (patch) | |
tree | 26bf76b6da4a16aa9b5dbb9549eadf13144d2594 /.config/i3status/check_proxy.py | |
parent | 551cd0d2a7a599011393ba39b74e31f25425748c (diff) |
added some changes to neovim config
Diffstat (limited to '.config/i3status/check_proxy.py')
-rwxr-xr-x | .config/i3status/check_proxy.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/.config/i3status/check_proxy.py b/.config/i3status/check_proxy.py new file mode 100755 index 0000000..a444a1d --- /dev/null +++ b/.config/i3status/check_proxy.py @@ -0,0 +1,27 @@ +#!/usr/bin/env /usr/bin/python3 + +import os +import json +import requests + +def check_proxy(): + return os.getenv("PROXY_ON_JCG") != None or os.getenv("HTTP_PROXY") != None or os.getenv("HTTPS_PROXY") != None + +def extract_address(): + return os.getenv("HTTPS_PROXY")[8:-5] + +def get_public_ip(): + return requests.get("https://api.ipify.org/").text + +if __name__ == "__main__": + if check_proxy(): + output_string = { + "full_text": f" {extract_address()}", + "color": "#00FF00", + } + else: + output_string = { + "full_text": f" N/A", + "color": "#FF0000", + } + print(json.dumps(output_string)) |