ttimer: notify the user when the timer ends - stopwatch - simple timer for cons… | |
git clone git://src.adamsgaard.dk/stopwatch | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit e6d2b8b1cbcf6cdf153bcffebf15750cff3dffd8 | |
parent 056f2e50e7795c50e3fd616034a39731ebc49d30 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 5 Nov 2020 09:12:35 +0100 | |
ttimer: notify the user when the timer ends | |
Diffstat: | |
M timer.1 | 5 +++++ | |
M timer.c | 4 ++++ | |
2 files changed, 9 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/timer.1 b/timer.1 | |
t@@ -20,6 +20,11 @@ is written in the format "%S s" for remaining time of less … | |
minute long, "%M:%SS" for durations less than one hour, and | |
"%H:%MM:%SS" for all longer durations. | |
.Pp | |
+In default mode, the program notifies the terminal via a bell | |
+character when the timer ends. When writing to the X root window | |
+.Fl ( x ) , | |
+the string "END" is displayed upon completion. | |
+.Pp | |
The options are as follows: | |
.Bl -tag -width Ds | |
.It Fl p Ar prefix | |
diff --git a/timer.c b/timer.c | |
t@@ -30,6 +30,7 @@ print_loop(unsigned int interval, char *prefix, char *postfi… | |
fflush(stdout); | |
sleep(interval); | |
} | |
+ printf("\a\n"); | |
} | |
void | |
t@@ -49,6 +50,9 @@ xroot_loop(unsigned int interval, char *prefix, char *postfi… | |
XSync(dpy, False); | |
sleep(interval); | |
} | |
+ snprintf(buf, sizeof(buf), "%sEND%s", prefix, postfix); | |
+ XStoreName(dpy, DefaultRootWindow(dpy), buf); | |
+ XSync(dpy, False); | |
} | |
int |