Add timers for notifications in new services dir
This commit is contained in:
parent
364da18441
commit
fd6a627c11
4 changed files with 60 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
**/**/plugins/*.plugin.js
|
||||
2
home.nix
2
home.nix
|
|
@ -23,6 +23,8 @@
|
|||
./programs/ssh
|
||||
./programs/wal
|
||||
./programs/xdg
|
||||
|
||||
./services/timers
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
|
|
|
|||
52
services/timers/default.nix
Normal file
52
services/timers/default.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
5
services/timers/scripts/notify-time.sh
Executable file
5
services/timers/scripts/notify-time.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue