[wikeyname] Prompt the user for a key if isatty(1).

This commit is contained in:
Kris Maglione 2010-06-16 18:35:32 -04:00
parent d9486fa419
commit f45311261e

View File

@ -5,6 +5,7 @@
#include <stuff/x.h> #include <stuff/x.h>
#include <fmt.h> #include <fmt.h>
#include <locale.h> #include <locale.h>
#include <unistd.h>
static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n"; static const char version[] = "wikeyname-"VERSION", "COPYRIGHT"\n";
@ -38,8 +39,10 @@ main(int argc, char *argv[]) {
if(!grabkeyboard(&scr.root)) if(!grabkeyboard(&scr.root))
fatal("can't grab keyboard\n"); fatal("can't grab keyboard\n");
if(isatty(1))
lprint(2, "Please press a key...\n");
event_loop(); event_loop();
print("%s\n", keyname); lprint(1, "%s\n", keyname);
XCloseDisplay(display); XCloseDisplay(display);
return 0; return 0;