ttimer: notify the user when the timer ends - stopwatch - simple timer for console or x root window
(HTM) git clone git://src.adamsgaard.dk/stopwatch
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit e6d2b8b1cbcf6cdf153bcffebf15750cff3dffd8
(DIR) parent 056f2e50e7795c50e3fd616034a39731ebc49d30
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
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(-)
---
(DIR) 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 than one
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
(DIR) diff --git a/timer.c b/timer.c
t@@ -30,6 +30,7 @@ print_loop(unsigned int interval, char *prefix, char *postfix, time_t duration)
fflush(stdout);
sleep(interval);
}
+ printf("\a\n");
}
void
t@@ -49,6 +50,9 @@ xroot_loop(unsigned int interval, char *prefix, char *postfix, time_t duration)
XSync(dpy, False);
sleep(interval);
}
+ snprintf(buf, sizeof(buf), "%sEND%s", prefix, postfix);
+ XStoreName(dpy, DefaultRootWindow(dpy), buf);
+ XSync(dpy, False);
}
int