better health reminder
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{ config, pkgs, lib, host, ... }:
|
{ pkgs, lib, host, ... }:
|
||||||
lib.mkIf (host != "NxACE")
|
lib.mkIf (host != "NxACE")
|
||||||
{
|
{
|
||||||
systemd.timers."health_reminder" = {
|
systemd.user.timers."health_reminder" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
@@ -11,11 +11,9 @@ lib.mkIf (host != "NxACE")
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."health_reminder" =
|
systemd.user.services."health_reminder" = let
|
||||||
let
|
hm = pkgs.writers.writePython3Bin "health_reminder" {
|
||||||
hm =
|
text = /*python*/ ''
|
||||||
let p = /*python*/ ''
|
|
||||||
#!${pkgs.python3}/bin/python3
|
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -35,25 +33,22 @@ lib.mkIf (host != "NxACE")
|
|||||||
return action
|
return action
|
||||||
|
|
||||||
actions = [
|
actions = [
|
||||||
Action("look away for %o Seconds!",300, ["10", "15"] ),
|
Action(action="look away for %o Seconds!", likelyhood=300, options=["10", "15"]),
|
||||||
Action("Posture Check!", 90 ),
|
Action(action="Posture Check!", likelyhood=300),
|
||||||
Action("Do %o Biceps curls!", 5, ["50", "100", "150"] ),
|
Action(action="Strech your upper body!", likelyhood=20),
|
||||||
Action("Do %o Shourlder thingees", 5, ["40 + 40", "50", "60"]),
|
Action(action="Strech your core!", likelyhood=10),
|
||||||
Action("Plank for %o senonds!", 5, ["60", "60", "70"] ),
|
Action(action="Strech your legs!", likelyhood=10),
|
||||||
Action("Strech your upper body!", 20 ),
|
Action(action="Strech your arms/hands!", likelyhood=10),
|
||||||
Action("Strech your core!", 10 ),
|
Action(action="Make Tea!", likelyhood=5),
|
||||||
Action("Strech your legs!", 10 ),
|
Action(action="说现在中文的时间!", likelyhood=2),
|
||||||
Action("Make Tea!", 5 ),
|
|
||||||
Action("Touch Grass!", 5 )
|
|
||||||
]
|
]
|
||||||
|
|
||||||
total_likelihood = sum(a.likelihood for a in actions)
|
total_likelihood = sum(a.likelihood for a in actions)
|
||||||
random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
|
random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
|
||||||
print(random_action)
|
print(random_action)
|
||||||
'';
|
'';
|
||||||
in pkgs.writeScriptBin "health_reminder" p;
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
script = ''
|
script = ''
|
||||||
set -eu
|
set -eu
|
||||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
|
||||||
|
|||||||
Reference in New Issue
Block a user