int main()
{
  Display *d;
  XEvent event;

  d = XOpenDisplay(NULL);
  if ( d != NULL ) {
                
    XGrabKey(d, XKeysymToKeycode(d, XStringToKeysym()), 
	     Mod1Mask,  
	     DefaultRootWindow(d), True, GrabModeAsync, GrabModeAsync);
    XGrabKey(d, XKeysymToKeycode(d, XStringToKeysym()), 
	     Mod1Mask, 
	     DefaultRootWindow(d), True, GrabModeAsync, GrabModeAsync);

    for(;;)
    {
      XNextEvent(d, &event);
      if ( event.type == KeyPress ) {
	KeySym s = XLookupKeysym(&event.xkey, 0);
	if ( s == XK_F7 ) {
	  printf();
	} else if ( s == XK_F6 ) {
	  break;
	}
      }
    }

    XUngrabKey(d, XKeysymToKeycode(d, XStringToKeysym()), Mod1Mask, DefaultRootWindow(d));
    XUngrabKey(d, XKeysymToKeycode(d, XStringToKeysym()), Mod1Mask, DefaultRootWindow(d));
  }
  return EXIT_SUCCESS;
}