2022-09-19 02:13:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#run this to start gammastep
|
|
|
|
#got this from https://rumpelsepp.org/blog/geolocation-for-gammastep/
|
|
|
|
#modified to be a posix shell script, and to save location data to a file
|
|
|
|
#so gammastep still works if internet is out.
|
|
|
|
|
2022-12-16 04:54:21 +00:00
|
|
|
JSFN="$HOME/.cache/gs_geoclue.json"
|
2022-09-19 02:13:02 +00:00
|
|
|
|
2022-12-16 04:54:21 +00:00
|
|
|
FN="$HOME/.cache/gs_geoclue.txt"
|
|
|
|
|
2022-12-16 05:07:37 +00:00
|
|
|
curl -Ls https://ipapi.co/json > "$JSFN".tmp
|
2022-12-16 04:54:21 +00:00
|
|
|
|
|
|
|
#dont update file if error received, could also check if an error flag is present
|
|
|
|
if [ "$(cat "$JSFN".tmp | wc -l)" -gt 4 ]; then
|
|
|
|
mv "$JSFN".tmp "$JSFN"
|
|
|
|
LAT="$( cat "$JSFN" | jq ".latitude" )"
|
|
|
|
LONG="$( cat "$JSFN" | jq ".longitude" )"
|
|
|
|
|
|
|
|
echo "$LAT $LONG" > "$FN"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
gammastep -l "$( cat "$FN" | cut -d' ' -f1)":"$( cat "$FN" | cut -d' ' -f2)" -m wayland
|