1
0
Fork 0

zsh: improve geolocate function

This commit is contained in:
Luca Bilke 2025-01-08 16:20:35 +01:00
parent 9fd4749a81
commit dd3d515dd6
Signed by: luca
GPG key ID: F6E11C9BAA7C82F5

View file

@ -13,6 +13,22 @@ function xsi() {
--preview-window=right:66%:wrap | xargs -ro xi
}
function geo() {
pos=$(curl -s "https://reallyfreegeoip.org/json/${1}")
lat=$(echo "$pos" | jq -r '.latitude')
lon=$(echo "$pos" | jq -r '.longitude')
create-static-map \
-c "${lat},${lon}" \
-m "${lat},${lon}" \
-t carto-dark \
--width=1024 \
--height=1024 \
-z 7 \
-o /dev/stdout |
chafa -f sixel --scale max
echo "$(echo "$pos" | jq -r '.city'), $(echo "$pos" | jq -r '.country_name')"
}
function whed() {
local script
script=$(which "$1")