On Sat, Jan 26, 2019 at 05:02:05PM +0100, dok wrote: > Hi, > > This is a simple patch to prevent from being locked by having dmenu > waiting on fgets to read from a tty with the keyboard already grabbed. > > cheers >
> From d579ee3221be1bd3fb5c1cf9c9bf55a2da68882c Mon Sep 17 00:00:00 2001 > From: dok <d...@grehack.fr> > Date: Sat, 26 Jan 2019 15:49:15 +0100 > Subject: [PATCH] Use slow path if stdin is a tty > > If stdin is a tty and dmenu is ran with the fast option then it's > impossible to close stdin because the keyboard is already grabbed. > --- > dmenu.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/dmenu.c b/dmenu.c > index 5c835dd..6b8f51b 100644 > --- a/dmenu.c > +++ b/dmenu.c > @@ -6,9 +6,7 @@ > #include <string.h> > #include <strings.h> > #include <time.h> > -#ifdef __OpenBSD__ > #include <unistd.h> > -#endif > > #include <X11/Xlib.h> > #include <X11/Xatom.h> > @@ -754,7 +752,7 @@ main(int argc, char *argv[]) > die("pledge"); > #endif > > - if (fast) { > + if (fast && !isatty(0)) { > grabkeyboard(); > readstdin(); > } else { > -- > 2.20.1 > Nice, applied and pushed. Thanks for the patch! -- Kind regards, Hiltjo