summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Viktor Semykin <thesame.ml@gmail.com>2010-01-05 00:45:28 +0200
committerGravatar Viktor Semykin <thesame.ml@gmail.com>2010-01-05 00:45:28 +0200
commit391e66078063b736b250d71607ef8738631680d7 (patch)
tree05673ba32a9464fdd3c428187d155e558c35f3fd
parent470763e1cf4ffa3e8a3e4110eadeb8a72e42c8eb (diff)
notification as external command
-rw-r--r--plugins/notification/notification.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/plugins/notification/notification.c b/plugins/notification/notification.c
index 91028350..38c68c9a 100644
--- a/plugins/notification/notification.c
+++ b/plugins/notification/notification.c
@@ -1,18 +1,18 @@
#include "../../deadbeef.h"
#include <stdio.h>
-#include <libnotify/notify.h>
+#include <stdlib.h>
static DB_misc_t plugin;
static DB_functions_t *deadbeef;
-static NotifyNotification *ntf;
static void
show_notification (const char *summary, const char *body)
{
- notify_notification_close (ntf, NULL);
- notify_notification_update (ntf, summary, body, NULL);
- notify_notification_show (ntf, NULL);
+ char cmd [1024];
+ if (!summary) summary = "Unknown track";
+ snprintf (cmd, sizeof (cmd), "notify-send '%s' '%s'", summary, body);
+ system (cmd);
}
static int
@@ -29,17 +29,11 @@ songchanged (DB_event_trackchange_t *ev, uintptr_t data) {
static int
notification_stop (void) {
- notify_notification_close (ntf, NULL);
deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (songchanged), 0);
}
static int
notification_start (void) {
- notify_init ("deadbeef");
-
- ntf = notify_notification_new (NULL, NULL, NULL, NULL);
- notify_notification_set_timeout (ntf, NOTIFY_EXPIRES_DEFAULT);
-
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (songchanged), 0);
return 1;
}