commit f45311261e62cae35ec55358cddd12c46cbed7d6
parent d9486fa4196f99c02a6c20ce0d049a7e6ef2a8ad
Author: Kris Maglione <kris@suckless.org>
Date: Wed, 16 Jun 2010 18:35:32 -0400
[wikeyname] Prompt the user for a key if isatty(1).
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/cmd/x11/wikeyname.c b/cmd/x11/wikeyname.c
@@ -5,6 +5,7 @@
#include <stuff/x.h>
#include <fmt.h>
#include <locale.h>
+#include <unistd.h>
static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n";
@@ -38,8 +39,10 @@ main(int argc, char *argv[]) {
if(!grabkeyboard(&scr.root))
fatal("can't grab keyboard\n");
+ if(isatty(1))
+ lprint(2, "Please press a key...\n");
event_loop();
- print("%s\n", keyname);
+ lprint(1, "%s\n", keyname);
XCloseDisplay(display);
return 0;