-
Notifications
You must be signed in to change notification settings - Fork 5
/
pomobeep.py
40 lines (30 loc) · 891 Bytes
/
pomobeep.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
# Copyright (c) 2018 Daniel Jakots
#
# Licensed under the MIT license. See the LICENSE file.
# Apply Pomodoro Technique and signal the user using the computer bell.
import subprocess
import time
SESSION = 25 * 60
SHORT_PAUSE = 5 * 60
LONG_PAUSE = 20 * 60
MUTE = ["xset", "b", "off"]
UNMUTE = ["xset", "b", "on"]
def beep():
subprocess.run(UNMUTE)
print('\a')
subprocess.run(MUTE)
def session():
for n in range(3):
print("session begins", time.strftime("%H:%M:%S", time.localtime()))
beep()
time.sleep(SESSION)
beep()
if n != 2:
print("spause begins", time.strftime("%H:%M:%S", time.localtime()))
time.sleep(SHORT_PAUSE)
else:
print("lpause begins", time.strftime("%H:%M:%S", time.localtime()))
time.sleep(LONG_PAUSE)
beep()
session()