The glib main loop is actually started now
2 files changed, 14 insertions(+), 2 deletions(-)

M meson.build
M src/notify.c
M meson.build +4 -1
@@ 2,6 2,9 @@ project('notif', 'c', default_options : 
 
 inc = include_directories('inc')
 gio = dependency('gio-2.0')
+threads = dependency('threads')
+
+deps = [gio, threads]
 
 subdir = 'libnotif-1'
 

          
@@ 12,6 15,6 @@ shared_library(
 	meson.project_name(),
 	'src/notify.c',
 	include_directories : inc,
-	dependencies : gio,
+	dependencies : deps,
 	install : true
 )

          
M src/notify.c +10 -1
@@ 356,11 356,20 @@ static void name_lost(GDBusConnection* c
 	fprintf(stderr, "Lost connection for %s\n", name);
 }
 
-void libnotif_init(void) {
+static void* run(void* data) {
+	(void) data;
 	if(!running) {
 		running = true;
 		g_bus_own_name(G_BUS_TYPE_SESSION, "org.freedesktop.Notifications", G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE, NULL, name_acquired, name_lost, NULL, NULL);
+		GMainLoop* loop = g_main_loop_new(NULL, FALSE);
+		g_main_loop_run(loop);
 	}
+	return NULL;
+}
+
+void libnotif_init(void) {
+	pthread_t thread;
+	pthread_create(&thread, NULL, run, NULL);
 }
 
 char** libnotif_get_info(void) {