about summary refs log tree commit diff
diff options
context:
space:
mode:
authordok <dok@grehack.fr>2019-01-26 15:49:15 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-01-27 15:26:04 +0100
commit11a65377da8fc198d15cf041dbbbb9718e5798cd (patch)
tree115f1723d96014635c17cd24342f952903760c44
parentdmenu_path: always use the cachedir (diff)
downloaddmenu-11a65377da8fc198d15cf041dbbbb9718e5798cd.tar.gz
dmenu-11a65377da8fc198d15cf041dbbbb9718e5798cd.tar.bz2
dmenu-11a65377da8fc198d15cf041dbbbb9718e5798cd.zip
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.
-rw-r--r--dmenu.c4
1 files changed, 1 insertions, 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 {