diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2016-12-07 22:33:02 +0100 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2016-12-07 22:33:02 +0100 |
commit | d6d2c4b6d53238e9c9fa431a68ba02c5664fda01 (patch) | |
tree | 3cd58d0375cc85060481cc773429926c9ff1ecba | |
parent | 6ad2d4486d8cd35c707ebf70d1e8b724e2c2b3f1 (diff) |
Added countdown timer to productivity mode
-rw-r--r-- | dwm.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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); |