Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.73 KB

README.md

File metadata and controls

55 lines (37 loc) · 1.73 KB

Script: Ipfinder

A script that shows your public IP address (if available) and your VPN status.


  1. Attempts to retrieve your public IP address and country of origin from the free but limited ipinfo.io service.
  2. If that fails, it will retrieve it from ifconfig.co instead. A failure may happen when you've reached your monthly threshold of free API requests.
  3. Finally, if that also fails, it will print your local IP address. Furthermore, assuming a tunnel is always created for a VPN connection, it will tell you whether you're currently connected to a VPN service or not:

If there is no Internet connection, it will show a broken link accordingly:

Dependencies

sudo apt install -y curl jq iproute2

Fonts

To display the icons properly, you'll need Font Awesome which you must also refer to in your [bar/...] module, e.g,:

font-0 = ...
font-1 = Font Awesome 5 Free:style=Solid:pixelsize=9; 2
font-2 = Font Awesome 5 Free:style=Regular:pixelsize=9; 2
font-3 = Font Awesome 5 Brands:pixelsize=9; 2
font-4 = Font Awesome 5 Free:style=Solid:pixelsize=7; 2

Module

[module/network]
type = custom/script
exec = ~/.config/polybar/ipfinder.sh
tail = true

Replace exec value with the path of this script. I usually store them in a ~/.config/scripts directory, but I've seen a lot of people use ~/.config/polybar instead. Remember to make it executable.

I encourage you to add a click-left event if you're using a VPN service. For example, I use Mullvad VPN:

...
tail = true
click-left = '/opt/Mullvad VPN/mullvad-vpn' &