+++ /dev/null
-* Handle multiple notifications at the same time
-* ~~Properly handle duration = 0~~
-* Keyboard shortcut to dismiss and accept notifications (also mouse)
-* ~~Properly print new lines~~
-* Refactor code
\ No newline at end of file
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
+#include <fcntl.h>
+#include <semaphore.h>
#include "config.h"
die("Usage: %s body", argv[0]);
signal(SIGALRM, expire);
-
- if (duration != 0)
- alarm(duration);
+ signal(SIGTERM, expire);
+ signal(SIGINT, expire);
display = XOpenDisplay(0);
XMapWindow(display, window);
+ sem_t *mutex = sem_open("/herbe", O_CREAT, 0644, 1);
+ sem_wait(mutex);
+
+ if (duration != 0)
+ alarm(duration);
+
while (1)
{
XEvent event;
break;
}
+ sem_post(mutex);
+ sem_close(mutex);
+ sem_unlink("/herbe");
+
for (int i = 0; i < num_of_lines; i++)
free(words[i]);
default:
- gcc herbe.c -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -lm -o herbe
+ gcc herbe.c -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -lm -pthread -o herbe
install: default
cp herbe /usr/local/bin