aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.c b/main.c
index 9453557..fff831b 100644
--- a/main.c
+++ b/main.c
@@ -1,10 +1,18 @@
1#include <pthread.h> 1#include <pthread.h>
2#include <signal.h>
2#include <unistd.h> 3#include <unistd.h>
3 4
4#include "glitch.h" 5#include "glitch.h"
5 6
6WindowManager wm = {0}; 7WindowManager wm = {0};
7 8
9void handle_signal(int signal) {
10 wm.running = 0;
11 wm.restart = 1;
12 printf("running: %d\n", wm.running);
13 log_message(stderr, LOG_DEBUG, "Signal received: %d", signal);
14}
15
8static void* expose_timer_thread(void* arg) { 16static void* expose_timer_thread(void* arg) {
9 (void)arg; 17 (void)arg;
10 18
@@ -49,6 +57,10 @@ int main(int argc, char *argv[]) {
49 pthread_detach(timer_tid); 57 pthread_detach(timer_tid);
50 } 58 }
51 59
60 // SIGUSR1 is used for restarting the window manager.
61 // kill -s SIGUSR1 $(pidof glitch)
62 signal(SIGUSR1, handle_signal);
63
52 wm.running = 1; 64 wm.running = 1;
53 while(wm.running) { 65 while(wm.running) {
54 XNextEvent(wm.dpy, &wm.ev); 66 XNextEvent(wm.dpy, &wm.ev);