This commit is contained in:
albert 2024-06-18 12:46:01 +09:00
parent 63a0aa60fa
commit 8d8fc06801
Signed by: albert
GPG key ID: 3895DD267CA11BA9

View file

@ -38,6 +38,7 @@
echo "Activating get-theme-times systemd service"
curl -s "https://api.sunrise-sunset.org/json?lat=35.680&lng=135.03&tzid=Asia/Tokyo" | fx .results.sunrise > /tmp/wttr.sunrise
curl -s "https://api.sunrise-sunset.org/json?lat=35.680&lng=135.03&tzid=Asia/Tokyo" | fx .results.sunset > /tmp/wttr.sunset
chmod ogu+rw /tmp/wttr.sunset /tmp/wttr.sunrise
echo "get-theme-times - complete"
'';
after = [ "networking-online.target" ];
@ -47,14 +48,15 @@
set-theme = {
enable = true;
script = ''
#!/bin/env bash
echo "set-theme.service - Checking for theme settings"
if [ ! -f /tmp/wttr.sunrise ] ; then
systemctl --user start get-theme-times.service
fi
echo "Getting dates:"
SUNRISE=`date $(cat /tmp/wttr.sunset) +%s`
SUNRISE=$(date -d "$(cat /tmp/wttr.sunset)" +%s)
echo "Sunrise: $SUNRISE"
SUNSET=`date $(cat /tmp/wttr.sunset) +%s`
SUNSET=$(date -d "$(cat /tmp/wttr.sunset)" +%s)
echo "Sunset: $SUNSET"
CURRENT=`date +%s`
echo "Current: $CURRENT"