From 6dd6fac293f26e6d8bcbc63b76929fa29e76c884 Mon Sep 17 00:00:00 2001 From: HelionSmoker <82761116+HelionSmoker@users.noreply.github.com> Date: Sun, 2 Apr 2023 19:05:29 +0300 Subject: [PATCH] Update sb-iplocate --- .local/bin/statusbar/sb-iplocate | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate index 02adab8d..1c2d1852 100755 --- a/.local/bin/statusbar/sb-iplocate +++ b/.local/bin/statusbar/sb-iplocate @@ -1,10 +1,12 @@ #!/bin/sh -# Gets your public ip address checks which country you are in and -# displays that information in the statusbar +# Displays the flag of the country you are in based on your public ip adress # # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ ifinstalled "geoip" || exit + addr="$(curl ifconfig.me 2>/dev/null)" || exit -grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" +country="$(geoiplookup "$addr" | sed -e 's/^[^,]*, //' -e 's/,.*$//')" # Keep only between 1st and 2nd comma +grep "flag: $country" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/chars/emoji" | + sed 's/flag:.*//' # Remove everything from 'flag:' onward