From d55edcb9b6239bd98fc82d0946e8e190fe1b8e3e Mon Sep 17 00:00:00 2001 From: Antonio Bibiano Date: Tue, 3 May 2016 10:29:46 +1000 Subject: [PATCH] Removed libnotify dependency --- config.def.h | 2 +- config.mk | 10 +++++----- spt.c | 14 ++++---------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/config.def.h b/config.def.h index 89f722f..96a8a9d 100644 --- a/config.def.h +++ b/config.def.h @@ -1,7 +1,7 @@ /* See LICENSE file for copyright and license details. */ /* Notification */ -static char *notifycmd = "libnotify"; /* Use libnotify or given command */ +static char *notifycmd = ""; /* Use libnotify or given command */ static char *notifyext = ""; /* Notify with extra command (eg. play an alarm) */ /* diff --git a/config.mk b/config.mk index 88b1134..d6e5d81 100644 --- a/config.mk +++ b/config.mk @@ -2,16 +2,16 @@ VERSION = 0.1 # Customize below to fit your system +#USE_LIBNOTIFY = -DUSE_LIBNOTIFY +#LIBNOTIFY_CFLAGS = `pkg-config --cflags libnotify` +#LIBNOTIFY_LIBS = `pkg-config --libs libnotify` # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man - # includes and libs -INCS = -I. -I/usr/include \ - `pkg-config --cflags libnotify` -LIBS = -L/usr/lib \ - `pkg-config --libs libnotify` +INCS = -I. -I/usr/include ${USE_LIBNOTIFY} ${LIBNOTIFY_CFLAGS} +LIBS = -L/usr/lib ${LIBNOTIFY_LIBSS} # flags CPPFLAGS = -DVERSION=\"${VERSION}\" diff --git a/spt.c b/spt.c index 9143ec1..81b41d2 100644 --- a/spt.c +++ b/spt.c @@ -6,8 +6,6 @@ #include #include -#include - #include "arg.h" char *argv0; @@ -58,13 +56,7 @@ spawn(char *cmd) void notify_send(char *cmt) { - if (!strcmp(notifycmd, "libnotify")) { /* use libnotify */ - 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, "")) { + if (strcmp(notifycmd, "")) { /* TODO(pickfire): merge this into spawn() */ if (fork() == 0) { setsid(); @@ -73,6 +65,8 @@ notify_send(char *cmt) perror(" failed"); exit(0); } + } else { + fprintf(stdout,"%s\n",cmt); } if (strcmp(notifyext, "")) /* extra commands to use */ @@ -97,7 +91,7 @@ remaining_time(int sigint) void usage(void) { - die("usage: %s [-e notifyext] [-n notifycmd] [-v]\n", argv0); + die("usage: %s [-n notifycmd] [-e notifyext] [-v]\n", argv0); } int