Compare commits

..

No commits in common. "747f5d3e692a0b1745584e6a7581e228f6eeeb20" and "b403ee295b1c8c1d06d1ddf12f30f12112a4d038" have entirely different histories.

4 changed files with 18 additions and 47 deletions

24
nixos/flake.lock generated
View file

@ -25,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1770260404, "lastModified": 1766553861,
"narHash": "sha256-3iVX1+7YUIt23hBx1WZsUllhbmP2EnXrV8tCRbLxHc8=", "narHash": "sha256-ZbnG01yA3O8Yr1vUm3+NQ2qk9iRhS5bloAnuXHHy7+c=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "0d782ee42c86b196acff08acfbf41bb7d13eed5b", "rev": "0999ed8f965bbbd991437ad9c5ed3434cecbc30e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -62,11 +62,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1770136044, "lastModified": 1766473571,
"narHash": "sha256-tlFqNG/uzz2++aAmn4v8J0vAkV3z7XngeIIB3rM3650=", "narHash": "sha256-5G1NDO2PulBx1RoaA6U1YoUDX0qZslpPxv+n5GX6Qto=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e576e3c9cf9bad747afcddd9e34f51d18c855b4e", "rev": "76701a179d3a98b07653e2b0409847499b2a07d3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -77,11 +77,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1770197578, "lastModified": 1766651565,
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=", "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2", "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -173,11 +173,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1770145881, "lastModified": 1766289575,
"narHash": "sha256-ktjWTq+D5MTXQcL9N6cDZXUf9kX8JBLLBLT0ZyOTSYY=", "narHash": "sha256-BOKCwOQQIP4p9z8DasT5r+qjri3x7sPCOq+FTjY8Z+o=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "17eea6f3816ba6568b8c81db8a4e6ca438b30b7c", "rev": "9836912e37aef546029e48c8749834735a6b9dad",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -2,6 +2,8 @@
let let
cfg = config.sisyphus.services.remEYEnder; cfg = config.sisyphus.services.remEYEnder;
icon = ./vecteezy_eyes-line-icon-vector-isolated_13932670.jpg;
in { in {
options.sisyphus.services.remEYEnder.enable = lib.mkEnableOption "Eye reminder"; options.sisyphus.services.remEYEnder.enable = lib.mkEnableOption "Eye reminder";
@ -11,10 +13,10 @@ in {
enable = true; enable = true;
description = "Send an eye reminder"; description = "Send an eye reminder";
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
script = builtins.readFile ./remEYEnder.sh; script = ''
path = with pkgs; [ # Display reminder for 20 seconds.
libnotify ${pkgs.libnotify}/bin/notify-send -t 20000 --icon=${icon} "RemEYEnder" "Look away from your screen :)"
]; '';
}; };
timers.remEYEnder = { timers.remEYEnder = {
enable = true; enable = true;

View file

@ -1 +0,0 @@
../../../../scripts/remEYEnder.sh

View file

@ -1,30 +0,0 @@
DURATION=20 # How long it takes to progress the bar fully
STEPS=100 # In how many steps to progress (> 0)
# Trick to fake decimals
EXP=3
interval_ms="$(( "${DURATION}" * ( 10 ** "${EXP}" ) / "${STEPS}" ))"
padded_interval_ms="$(printf "%0${EXP}d" "${interval_ms}")"
interval_s="${padded_interval_ms:0:-${EXP}}.${padded_interval_ms:-${EXP}}"
end_time="$(( "$( date '+%s' )" + "${DURATION}" + 1 ))"
# notify-send args
replace_id="${end_time}"
expire_time="$(( "${interval_ms}" + 1 ))" # To avoid flickering
counter=0
while [[ "${end_time}" -gt "$( date '+%s' )" ]]; do
# Remap to [0, 100]
remaining_part="$(( ("${STEPS}" - "${counter}") * 100 / "${STEPS}" ))"
notify-send \
'Look away from your screen :)' 'RemEYEnder' \
--hint="int:value:${remaining_part}" \
--category='sysinfo' \
--replace-id="${replace_id}" \
--expire-time="${expire_time}"
counter="$(( "${counter}" + 1 ))"
sleep "${interval_s}"
done