1
0
Fork 0

Fix sleep-nag

This commit is contained in:
Malte Brandy 2021-07-09 01:42:07 +02:00
parent a2eb193959
commit 4c9e1d882b

View file

@ -16,12 +16,14 @@ let
time <- getZonedTime time <- getZonedTime
let tod = localTimeOfDay . zonedTimeToLocalTime$ time let tod = localTimeOfDay . zonedTimeToLocalTime$ time
hour = todHour tod hour = todHour tod
minute = todMinute tod
evening = hour == 0
night = (hour < 6 && hour >= 1) night = (hour < 6 && hour >= 1)
if night then do { action
notify_send ([i|Es ist #{formatTime defaultTimeLocale "%H:%M" time} Uhr: Zeit ins Bett zu gehen!|]::String) "Du kannst das hier auch morgen tun!"; | evening = notify_send "Shutdown alert!" ([i|Rechner fährt in #{59-minute} Minuten runter.|]::String)
threadDelay 600000000} | night = exe "/run/current-system/sw/bin/sudo" "systemctl" "shutdown"
else action
threadDelay 600000000 threadDelay 600000000
''; '';
in in
{ {