From 423435ba51e22335c834b1c75f221381d38ed2cb Mon Sep 17 00:00:00 2001 From: speediegq Date: Sat, 8 Oct 2022 11:18:25 +0200 Subject: [PATCH] statuscmd: Write lastbutton to /tmp/speedwm-button as it seems to work better --- speedwm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/speedwm.c b/speedwm.c index c150842..5c6d027 100644 --- a/speedwm.c +++ b/speedwm.c @@ -4752,6 +4752,7 @@ sortscreens(XineramaScreenInfo *screens, int n) void spawn(const Arg *arg) { + FILE *buttonfile = fopen("/tmp/speedwm-button", "w"); if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); @@ -4761,6 +4762,14 @@ spawn(const Arg *arg) if (statuscmdn == statuscmds[i].id) { statuscmd[2] = statuscmds[i].cmd; setenv("BUTTON", lastbutton, 1); + int writestatus = fputs(lastbutton, buttonfile); + if (writestatus == EOF) { + fprintf(stderr, "speedwm: failed to write statuscmd button.\n"); + return; + } + + fclose(buttonfile); + break; } }