Geolocation for Gammastep

Published: October 26, 2021 · Next

I use the gammastep utility for enabling a redshifty nightlight on my desktop. Since gammastep supports wayland and sway supports the wayland protocols in play it is works for me. Now to the annoying part of it: Geolocation. Geolocation is needed that gammastep knows on which time it needs to enable the nightlight.

I am a lazy person and I want that my ducktaped computer works without my intervention most of the time. There is geoclue for this; which is a nightmare to set up on non-gnome. Best part, it doesn't work reliably. Annoying.

Eventually, I wrote my own simple wrapper for gammastep using a web service I found while I was procastinating. Here is the shell two-liner (six-liner including shebang, blank lines, and bash settings); paste this into ~/.local/bin/

#!/usr/bin/env bash

set -eu

resp="$(curl -Ls"
gammastep -l "$(jq ".latitude" <<< "$resp")":"$(jq ".longitude" <<< "$resp")" -m wayland

Paste this into ~/.config/systemd/user/gammastep.service:

Description=Display colour temperature adjustment NetworkManager-wait-online.service



Now you have fancy gammastep with geolocation capabilites which can be started via:

$ systemctl --user start gammastep

A restart of the service triggers a location update. :)