commit d55edcb9b6239bd98fc82d0946e8e190fe1b8e3e
parent cafb6102dbf20da051ea75e028bbef7d12a4478e
Author: Antonio Bibiano <antbbn@gmail.com>
Date: Tue, 3 May 2016 10:29:46 +1000
Removed libnotify dependency
Diffstat:
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git 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
@@ -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
@@ -6,8 +6,6 @@
#include <unistd.h>
#include <signal.h>
-#include <libnotify/notify.h>
-
#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