Skip to content

swiftbar - check ip address

swiftbar is a simple utility to put information in the macOS menu bar. For no particular reason, I created this little script which checks my current IPv4 and IPv6 address and displays either a lock if they both resolve to GB, or a warning emoji if not.

use the following filename to run the script every 10 minutes:
#!/usr/bin/env bash

# <bitbar.title>IP Addresses</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <>Jonas</>
# <>pew</>
# <bitbar.desc>Checks the client's IPv4 and IPv6 Address.</bitbar.desc>

ipv4=$(/usr/bin/curl -s -4
ipv6=$(/usr/bin/curl -s -6

# Check if both variables are "GB"
if [[ "$ipv4" == "GB" && "$ipv6" == "GB" ]]; then
    echo ":lock.fill: | sfsize=16"
    # If not, echo an alert emoji
    echo "⚠️"