zsh: improve geolocate function
This commit is contained in:
parent
9fd4749a81
commit
dd3d515dd6
1 changed files with 16 additions and 0 deletions
|
@ -13,6 +13,22 @@ function xsi() {
|
||||||
--preview-window=right:66%:wrap | xargs -ro xi
|
--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() {
|
function whed() {
|
||||||
local script
|
local script
|
||||||
script=$(which "$1")
|
script=$(which "$1")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue