feat: apod timer changes

This commit is contained in:
Jet 2026-05-06 11:41:44 -07:00
parent 07e7d2e047
commit a7c9e90046
No known key found for this signature in database
3 changed files with 10 additions and 8 deletions

View file

@ -81,7 +81,7 @@ let
read_api_key_file /etc/nasa-api.env read_api_key_file /etc/nasa-api.env
fi fi
if [ -z "$api_key" ]; then if [ -z "$api_key" ]; then
api_key="DEMO_KEY" exit 0
fi fi
today="$(date +%F)" today="$(date +%F)"
@ -400,6 +400,7 @@ in
description = "Fetch NASA APOD wallpaper for greetd"; description = "Fetch NASA APOD wallpaper for greetd";
after = [ "network-online.target" ]; after = [ "network-online.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
restartIfChanged = false;
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${fetchGreetdApod}/bin/greetd-apod-wallpaper"; ExecStart = "${fetchGreetdApod}/bin/greetd-apod-wallpaper";
@ -411,9 +412,9 @@ in
systemd.timers.greetd-apod-wallpaper = { systemd.timers.greetd-apod-wallpaper = {
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
OnBootSec = "30s"; OnActiveSec = "2m";
OnCalendar = "hourly"; OnUnitActiveSec = "1h";
Persistent = true; Persistent = false;
Unit = "greetd-apod-wallpaper.service"; Unit = "greetd-apod-wallpaper.service";
}; };
}; };

View file

@ -174,7 +174,7 @@ let
read_api_key_file "''${NASA_API_KEY_FILE:-${config.home.homeDirectory}/.config/nasa-api.env}" read_api_key_file "''${NASA_API_KEY_FILE:-${config.home.homeDirectory}/.config/nasa-api.env}"
fi fi
if [ -z "$api_key" ]; then if [ -z "$api_key" ]; then
api_key="DEMO_KEY" exit 0
fi fi
api_curl_args=( api_curl_args=(

View file

@ -292,6 +292,7 @@ in
Description = "Fetch NASA APOD wallpaper"; Description = "Fetch NASA APOD wallpaper";
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
X-RestartIfChanged = false;
}; };
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
@ -304,9 +305,9 @@ in
systemd.user.timers.nasa-apod-wallpaper = { systemd.user.timers.nasa-apod-wallpaper = {
Unit.Description = "Refresh NASA APOD wallpaper regularly"; Unit.Description = "Refresh NASA APOD wallpaper regularly";
Timer = { Timer = {
OnStartupSec = "2m"; OnActiveSec = "2m";
OnCalendar = "hourly"; OnUnitActiveSec = "1h";
Persistent = true; Persistent = false;
Unit = "nasa-apod-wallpaper.service"; Unit = "nasa-apod-wallpaper.service";
}; };
Install.WantedBy = [ "timers.target" ]; Install.WantedBy = [ "timers.target" ];