zquestz / geoclue-tz

Generate geoclue /etc/geolocation based on the current time zone.
MIT License
4 stars 0 forks source link

geoclue-tz

License ReportCard Build Release

Generate geoclue /etc/geolocation based on the current time zone.

Usage:
  geoclue-tz [flags]

Flags:
  -c, --completion string   completion script for bash, zsh or fish
  -d, --dry-run             dry run debug mode
  -h, --help                help for geoclue-tz
  -l, --location string     enable custom location
      --version             display version

Usage

Update /etc/geolocation based on the current time zone.

sudo geoclue-tz

Update /etc/geolocation based on your custom home location.

sudo geoclue-tz -l home

Install

Make sure that GOPATH and GOBIN env vars are set. Then run:

go install github.com/zquestz/geoclue-tz@latest
sudo cp $GOPATH/bin/geoclue-tz /usr/bin

Arch Linux users can install from the AUR:

yay -S geoclue-tz

Configuration

To setup your own configuration just create /etc/geoclue-tz.conf. The configuration file is in UCL format. This makes it super easy to set the values for your custom locations, and restore them whenever you want.

For more information about UCL visit: https://github.com/vstakhov/libucl

The following keys are supported:

Here is a sample configuration, with a single custom location. The only required keys are latitude, longitude, and name.

locations [
  {
    latitude = 19.520960
    longitude = 155.920517
    altitude = 0
    accuracy = 1000
    name = home
  }
]

Shell Autocompletion

To set up autocompletion:

Bash

sudo bash -c "geoclue-tz --completion bash > /etc/bash_completion.d/geoclue-tz"

Zsh

Generate a _geoclue-tz completion script and put it somewhere in your $fpath:

sudo zsh -c "geoclue-tz --completion zsh > /usr/share/zsh/site-functions/_geoclue-tz"

Fish

geoclue-tz --completion fish > ~/.config/fish/completions/geoclue-tz.fish

License

geoclue-tz is released under the MIT license.