Get your conky location aware

Fri 19 February 2010
  • 装备 tags:
  • conky
  • GIS
  • linux
  • location published: true comments: true

2010-02-19-225826_188x44_scrot

Add this in your conkyrc
[cc lang="text" nowrap="0"]
${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip/gml:name/text()" -q} ${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip//gml:coordinates/text()" -q}
[/cc]

Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like
[cc lang="xml" nowrap="0"] This is the Hostip Lookup Service hostip inapplicable 58.212.88.212 Nanjing CHINA CN 118.883,32.05 [/cc]

Because it uses ip to lookup your address, you cannot expect higher resolution and precision currently.