commit - 95eeecbe5f3f4edfeb5f5e93b4bebd14744f30b2
commit + a08809ec69ae6dd0ca37a31535b8a0a3405883e5
blob - e3561d389654adb32ec21d28b3a67a9d0893e0c4
blob + c5ee2b825f258d251f5b5a9227cb12bcf2aac428
--- bxnotify.c
+++ bxnotify.c
static int cfg_padding = PADDING;
static int cfg_border_width = BORDER_WIDTH;
static int cfg_stack_gap = STACK_GAP;
+static int cfg_max_stack = MAX_STACK;
static int cfg_align = ALIGN;
static int cfg_duration = DURATION;
static const char *cfg_fg = FG_COLOR;
int lowest_y = 0;
/* Store valid PIDs so we can rewrite the file cleanly */
- char valid_lines[100][64];
+ char valid_lines[cfg_max_stack][64];
int valid_count = 0;
/* Open the file descriptor as a FILE* for easy reading with fgets */
int pid, y, h;
/* 1. Read existing entries and find the lowest Y */
- while (fgets(line, sizeof(line), f) && valid_count < 100) {
+ while (fgets(line, sizeof(line), f) && valid_count < cfg_max_stack) {
if (sscanf(line, "%d %d %d", &pid, &y, &h) == 3) {
if (kill(pid, 0) == 0) { /* Process is still alive */
if ((y + h) > lowest_y)
FILE *f = fdopen(fd, "r+");
if (f) {
char line[64];
- char keep[100][64];
+ char keep[cfg_max_stack][64];
int count = 0;
int my_pid = getpid();
- while (fgets(line, sizeof(line), f) && count < 100) {
+ while (fgets(line, sizeof(line), f) && count < cfg_max_stack) {
int pid;
sscanf(line, "%d", &pid);
/* Keep if it's not ours AND process is alive */
blob - eb4b7c67ec56f39af16d7795e0efeae2ec64c91b
blob + c776baaa995ce9eb75b97f7986a469cfc4742c6c
--- config.def.h
+++ config.def.h
#define PADDING 6
#define BORDER_WIDTH 2
#define STACK_GAP 16
+#define MAX_STACK 100 /* Maximum concurrent notifications */
#define BORDER_COLOR "#555555"
#define FG_COLOR "#ffffff"
#define BG_COLOR "#000000"