Add timers for notifications in new services dir

This commit is contained in:
JuliaLange 2024-02-22 23:57:21 -08:00
parent 364da18441
commit fd6a627c11
4 changed files with 60 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
**/**/plugins/*.plugin.js

View file

@ -23,6 +23,8 @@
./programs/ssh
./programs/wal
./programs/xdg
./services/timers
];
home.packages = with pkgs; [

View file

@ -0,0 +1,52 @@
{ config, pkgs, ... }:
let rootPath = ./.; in
{
systemd.user.timers = {
hourly-time = {
Timer = {
OnCalendar = "hourly";
};
Install = {
WantedBy = [
"timers.target"
];
};
};
quarterly-time = {
Timer = {
OnCalendar = "*-*-* *:15,30,45:00";
};
Install = {
WantedBy = [
"timers.target"
];
};
};
};
systemd.user.services = {
hourly-time = {
Unit = {
Description = "Notify the user every hour of time passing";
};
Service = {
Type="simple";
ExecStart="/home/pan/.config/timer_scripts/notify-time.sh 60000";
};
};
quarterly-time = {
Unit = {
Description = "Notify the user every 15 minutes of time passing, \
skips hours";
};
Service = {
Type="simple";
ExecStart="/home/pan/.config/timer_scripts/notify-time.sh 10000";
};
};
};
xdg.configFile."timer-scripts" = {
source = rootPath + "/scripts";
target = "timer_scripts/";
executable = true;
};
}

View file

@ -0,0 +1,5 @@
#!/bin/sh
export DISPLAY=":0"
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
/home/pan/.nix-profile/bin/notify-send "$(/run/current-system/sw/bin/date +%H:%M)" -t $1