Gnome/metacity keybinding won't permit program to wait for a keystroke,

User Name

Remember Me?

Password

Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Gnome/metacity keybinding won't permit program to wait for a keystroke,

All,

I have a little GUI utility written in C that requires the user to press a key to make a menu selection. The code is predictably simple:

system("stty raw");
save_ID = getchar();
system("stty cooked");

'getchar()' grabs the keystroke and the two 'system' lines make it so that it doesn't need to wait for ENTER. It works fine from the command line, however, when I bind the command to a hotkey in Gnome with metacity, it waits for the keystroke alright, but the keystroke then seems to be processed not as as input to the command as it should, but as if it were a separate command. Eg. if my keystroke is "1" and I'm in a terminal I see:

"zsh: command not found: 1"

A non-interactive version of the program works fine when bound to a hotkey, so the program is basically functional, it just can't be used interactively when called via a hotkey. Is there anything I can do about this? If metacity won't cooperate, is there some other macro/hotkey utility that would grab the keystroke properly?