pomo

A simple pomodoro timer
Log | Files | Refs | README | LICENSE

commit 4844396830fe79f995b298c35b99200b04f6809e
parent 161f63ae60e0a4c2de75be01ce5074932d2ebf7f
Author: Ivan Tham <pickfire@riseup.net>
Date:   Sat, 29 Oct 2016 13:02:15 +0800

Simple logic fixup and prepare for release

- When -D_NOTIFY, notifycmd (-m) will be runned now
- Remove '\n' in buf in display_state() for -m echo
- Remove break; after usage() since die() is called
- Hooray! TODO is clean, everything is nice for now
- Haha, yet another rectangle blocky commit message

Diffstat:
MTODO | 6+-----
Mspt.c | 24++++++++++++------------
2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/TODO b/TODO @@ -1,5 +1 @@ -Misc ----- - $ grep -n 'TODO' spt.c - -# vim:ft=markdown: +Good luck! Nothing TODO for now. diff --git a/spt.c b/spt.c @@ -63,16 +63,17 @@ spawn(char *cmd, char *cmt) void notify_send(char *cmt) { -#ifdef NOTIFY - notify_init("spt"); - NotifyNotification *n = notify_notification_new("spt", cmt, \ - "dialog-information"); - notify_notification_show(n, NULL); - g_object_unref(G_OBJECT(n)); - notify_uninit(); -#else - if (strcmp(notifycmd, "")) /* TODO: call function in config.h */ + if (strcmp(notifycmd, "")) spawn(notifycmd, cmt); +#ifdef NOTIFY + else { + notify_init("spt"); + NotifyNotification *n = notify_notification_new("spt", cmt, \ + "dialog-information"); + notify_notification_show(n, NULL); + g_object_unref(G_OBJECT(n)); + notify_uninit(); + } #endif /* NOTIFY */ if (strcmp(notifyext, "")) /* extra commands to use */ @@ -82,9 +83,9 @@ notify_send(char *cmt) void display_state(int remaining, int suspend) { - char buf[22]; + char buf[21]; - snprintf(buf, 22, "Remaining: %02d:%02d %s\n", + snprintf(buf, 21, "Remaining: %02d:%02d %s", remaining / 60, remaining % 60, (suspend) ? "◼" : "▶"); @@ -131,7 +132,6 @@ main(int argc, char *argv[]) "see LICENSE for details\n"); default: usage(); - break; } ARGEND; /* add SIGUSR1 handler: remaining_time */