Skip to content

Commit

Permalink
A nicer way to show your reminders (especially if they're longer than…
Browse files Browse the repository at this point in the history
… expected)
  • Loading branch information
nardinan committed Feb 10, 2023
1 parent 222d709 commit 87fc2d0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@
*/
#include "notification.h"
void f_notification_show(const char *title, const char *message, const char *icon) {
NotifyNotification *notification;
notify_init(d_application_name);
if ((notification = notify_notification_new(title, message, icon))) {
notify_notification_set_urgency(notification, NOTIFY_URGENCY_CRITICAL);
notify_notification_set_timeout(notification, NOTIFY_EXPIRES_NEVER);
notify_notification_show(notification, NULL);
char *formatted_message_buffer = NULL;
if (message)
asprintf(&formatted_message_buffer, "<b>%s</b>\n%s", title, message);
else
asprintf(&formatted_message_buffer, "<b>%s</b>", title);
if (formatted_message_buffer) {
NotifyNotification *notification;
notify_init(d_application_name);
if ((notification = notify_notification_new(d_application_name" says:", formatted_message_buffer, icon))) {
notify_notification_set_urgency(notification, NOTIFY_URGENCY_CRITICAL);
notify_notification_set_timeout(notification, NOTIFY_EXPIRES_NEVER);
notify_notification_show(notification, NULL);
}
free(formatted_message_buffer);
}
}

0 comments on commit 87fc2d0

Please sign in to comment.