sisyphus/nixos/modules/services/remEYEnder/default.nix

36 lines
972 B
Nix
Raw Permalink Normal View History

2024-09-19 15:29:55 +02:00
{ config, lib, pkgs, ... }:
let
cfg = config.sisyphus.services.remEYEnder;
2024-09-19 15:56:13 +02:00
icon = ./vecteezy_eyes-line-icon-vector-isolated_13932670.jpg;
2024-09-19 15:29:55 +02:00
in {
2024-09-19 15:56:13 +02:00
options.sisyphus.services.remEYEnder.enable = lib.mkEnableOption "Eye reminder";
2024-09-19 15:29:55 +02:00
config = lib.mkIf cfg.enable {
systemd.user = {
services.remEYEnder = {
enable = true;
description = "Send an eye reminder";
serviceConfig.Type = "oneshot";
script = ''
# Display reminder for 20 seconds.
2024-09-19 15:56:13 +02:00
${pkgs.libnotify}/bin/notify-send -t 20000 --icon=${icon} "RemEYEnder" "Look away from your screen :)"
2024-09-19 15:29:55 +02:00
'';
};
timers.remEYEnder = {
enable = true;
description = "Timer for remEYEnders, runs every 20 minutes.";
wantedBy = [
"timers.target"
];
timerConfig = {
OnActiveSec = "20min";
OnUnitActiveSec = "20min";
Unit = "remEYEnder.service";
};
};
};
};
}