25 lines
428 B
Python
Executable File
25 lines
428 B
Python
Executable File
#!/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]
|
|
|
|
run(["notify-send", f"Starting alarm {name}, duration of {duration}s"])
|
|
|
|
current = time()
|
|
end = current + duration
|
|
|
|
while (time() <= end):
|
|
sleep(1)
|
|
|
|
run(["notify-send", f"alarm: Alarm {name} complete"])
|