tmisu

Notification to stdout daemon
git clone https://git.inz.fi/tmisu/
Log | Files | Refs | README | LICENSE

commit 66887b914234cdb50ff626ee80b8e19a1d1b5cf4
parent dba7000d94dba8a85c33c51ce78942f365bbff09
Author: Sweets <Sweets@users.noreply.github.com>
Date:   Sat, 25 Apr 2020 09:57:01 -0700

Add: skeleton

Diffstat:
AMakefile | 3+++
Aconfig.h | 4++++
Anote.c | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anote.h | 8++++++++
4 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,3 @@ + +all: + $(CC) `pkg-config --libs --cflags glib-2.0 gio-2.0` note.c diff --git a/config.h b/config.h @@ -0,0 +1,4 @@ +// #define RECEIVE_ACTIONS +// #define RECEIVE_APP_ICON +// #define RECEIVE_REPLACES_ID +// #define RECEIVE_EXPIRE_TIMEOUT diff --git a/note.c b/note.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <string.h> + +#include <gio/gio.h> +#include <glib.h> + +#include "note.h" +#include "config.h" + +GDBusConnection *dbus_connection = NULL; +const char *introspection = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<node name=\"/org/freedesktop/Notifications\">\n" + " <interface name=\"org.freedesktop.Notifications\">\n" + " <method name=\"Notify\">\n" +#ifdef RECEIVE_ACTIONS + " <arg direction=\"in\" name=\"actions\" type=\"as\"/>\n" +#endif +#ifdef RECEIVE_APP_ICON + " <arg direction=\"in\" name=\"app_icon\" type=\"s\"/>\n" +#endif + " <arg direction=\"in\" name=\"app_name\" type=\"s\"/>\n" + " <arg direction=\"in\" name=\"body\" type=\"s\"/>\n" +#ifdef RECEIVE_EXPIRE_TIMEOUT + " <arg direction=\"in\" name=\"expire_timeout\" type=\"i\"/>\n" +#endif + " <arg direction=\"in\" name=\"hint\" type=\"a{sv}\"/>\n" + " <arg direction=\"in\" name=\"id\" type=\"u\"/>\n" +#ifdef RECEIVE_REPLACES_ID + " <arg direction=\"in\" name=\"replaces_id\" type=\"u\"/>\n" +#endif + " <arg direction=\"in\" name=\"summary\" type=\"s\"/>\n" + " </method>\n" + " </interface>\n" + "</node>"; + +int main(int argc, char **argv) { + /* Build introspection */ + guint owned_name; + GDBusNodeInfo *introspection_data; + + introspection_data = g_dbus_node_info_new_for_xml(introspection, NULL); + owned_name = g_bus_own_name(G_BUS_TYPE_SESSION, + "org.freedesktop.Notifications", + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, NULL, NULL, NULL, NULL); + + printf("%s\n", introspection); + sleep(10); + + g_clear_pointer(&introspection_data, g_dbus_node_info_unref); + g_bus_unown_name(owned_name); + + /* What now? */ +} diff --git a/note.h b/note.h @@ -0,0 +1,8 @@ +#pragma once + +#include <gio/gio.h> +#include <glib.h> + +extern GDBusConnection *dbus_connection; + +char *build_introspection_xml(void);