#!/bin/sh # Gets your public ip address checks which country you are in and # displays that information in the statusbar # # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ ifinstalled "geoip" || exit 1 ipfile="$XDG_RUNTIME_DIR/iplocate" addr=$(cat "$ipfile" 2>/dev/null) && addr=$(geoiplookup "$addr" 2>/dev/null) && rm "$ipfile" || { ( curl --retry 5 -sfm 10 ifconfig.me > "$ipfile" && pkill -RTMIN+"${1:-27}" "${STATUSBAR:-dwmblocks}" ) & echo; exit; } name="${addr##*, }" flag="$(grep "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji")" flag="${flag%% *}" printf "%s %s\\n" "$flag" "$name"