aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2016-12-07 22:33:02 +0100
committerEduardo Pedroni <e.pedroni91@gmail.com>2016-12-07 22:33:02 +0100
commitd6d2c4b6d53238e9c9fa431a68ba02c5664fda01 (patch)
tree3cd58d0375cc85060481cc773429926c9ff1ecba
parent6ad2d4486d8cd35c707ebf70d1e8b724e2c2b3f1 (diff)
Added countdown timer to productivity mode
-rw-r--r--dwm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dwm.c b/dwm.c
index 41ae6e2..571f779 100644
--- a/dwm.c
+++ b/dwm.c
@@ -860,9 +860,12 @@ drawbar(Monitor *m) {
struct timeval tv;
gettimeofday(&tv, NULL);
- if (tv.tv_sec - latestlock.tv_sec < ptimeout)
- drawtext(dc.drawable, "\uE2FC", 2, True);
- else
+ char locktime[10];
+ long timepassed = tv.tv_sec - latestlock.tv_sec;
+ if (timepassed < ptimeout) {
+ sprintf(locktime, "\uE2FC %d:%02d", (int) (ptimeout - timepassed) / 60, (int) (ptimeout - timepassed) % 60);
+ drawtext(dc.drawable, locktime, 2, True);
+ } else
drawtext(dc.drawable, NULL, 0, False);
XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);