From f022bb1d9540e3ad56814f911d6fc3476b3645fa Mon Sep 17 00:00:00 2001 From: speedie Date: Sat, 12 Aug 2023 05:17:03 +0200 Subject: [PATCH] Fix some small bugs with the FIFO --- libs/fifo.c | 14 +++++++++----- spmenu.c | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libs/fifo.c b/libs/fifo.c index 048b67f..8d793eb 100644 --- a/libs/fifo.c +++ b/libs/fifo.c @@ -20,6 +20,8 @@ void execute_fifo_cmd(void) { if (!r) { close(fd); + done = 1; + return; } @@ -115,7 +117,7 @@ void execute_fifo_cmd(void) { setlines(&arg); } else if (!strcmp(fifot, "setcolumns+")) { Arg arg; - arg.i = +1; + arg.i = 1; setcolumns(&arg); } else if (!strcmp(fifot, "setcolumns-")) { Arg arg; @@ -183,22 +185,24 @@ void execute_fifo_cmd(void) { close(fd); + remove(fifofile); + mkfifo(fifofile, 0660); + done = 1; } void *fifocmd(void *n) { for (;;) { - msleep(0.1); - if (done) { execute_fifo_cmd(); } + + msleep(0.1); } } void init_fifo(void) { - mkfifo(fifofile, 0666); - + mkfifo(fifofile, 0660); pthread_t tid; pthread_create(&tid, NULL, &fifocmd, NULL); } diff --git a/spmenu.c b/spmenu.c index 9ef9e81..6efc4aa 100644 --- a/spmenu.c +++ b/spmenu.c @@ -555,11 +555,10 @@ void handle(void) { init_appearance(); // init colorschemes by reading arrays + setupdisplay_x11(); // set up display and create window #if FIFO init_fifo(); #endif - - setupdisplay_x11(); // set up display and create window eventloop_x11(); // function is a loop which checks X11 events and calls other functions accordingly #endif #if WAYLAND