I need to add buttons to the bottom of a libnotify notification that run functions when clicked. I can make the buttons appear, but they don't run the functions when clicked. It gives no error message at all.
The program is called with ./notifications "Title" "Body" "pathtoicon"
Code:
#include <libnotify/notify.h>
#include <iostream>
void callback_mute(NotifyNotification* n, char* action, gpointer user_data) {
std::cout << "Muting Program" << std::endl;
system("pkexec kernel-notify -am");
}
int main(int argc, char * argv[] ) {
GError *error = NULL;
notify_init("Basics");
NotifyNotification* n = notify_notification_new (argv[1],
argv[2],
argv[3]);
notify_notification_add_action (n,
"action_click",
"Mute",
NOTIFY_ACTION_CALLBACK(callback_mute),
NULL,
NULL);
notify_notification_set_timeout(n, 10000);
if (!notify_notification_show(n, 0)) {
std::cerr << "Notification failed" << std::endl;
return 1;
}
return 0;
}
Any help would be greatly appreciated, thanks!