aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/alarm
blob: 7dd4621cb5e4dffd59ee7ab4245378be6563ed82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

from time import time, sleep
from sys import argv
from subprocess import run


name = "Alarm"
duration = 1

if (len(argv) > 1):
    duration = float(argv[1])
if (len(argv) > 2):
    name = argv[2]

duration *= 3600

print("Starting alarm '%s'" % name, "of duration %ds" % duration)

current = time()
end = current + duration

while (time() <= end):
    sleep(1)

run(["notify-send", f"alarm: Alarm {name} complete"])