LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   I need to disable ESC ... (https://www.linuxquestions.org/questions/programming-9/i-need-to-disable-esc-293234/)

JoannesX 02-21-2005 10:02 PM

I need to disable ESC ...
 
hello guys!

Ok, I just need to disable the ESC key while running a script..
I don't want it to close my dialog boxes.. please help!!!

I've already used the trap command to block the kill signals and to block CTRL + C from closing the script..
But what I really want is that the script goes til the end with no kind of keyboard interruption!

Please, help! thanks

jlliagre 02-21-2005 11:07 PM

ESC is not a character supposed to interrupt shell scripts.
Can you explain more ?

JoannesX 02-22-2005 10:53 AM

no it surely does not stop or close or kill shell scripts..
but it closes DIALOG BOXES.. and that is my problem, you know?

for example:

Code:

dialog --msgbox "This is the text that appears in the dialog" 10 30
and the option that appears in the dialog box is only the OK button.

BUT if I press ESC, the dialog closes..

jlliagre 02-22-2005 11:19 AM

Try that one:
Code:

code=$(xmodmap -pk | grep "(Escape)" | nawk '{print $1}')
if [ "$code" -gt 0 ]
then
        xmodmap -e "keycode $code = Space Escape"
fi
dialog --msgbox "This is the text that appears in the dialog" 10 30
if [ "$code" -gt 0 ]
then
        xmodmap -e "keycode $code = Escape"
fi

Beware that the key mapping is not restricted to the dialog window, but affect the whole X11 server ...
You can still use Shift-escape with my mapping.

JoannesX 02-22-2005 01:05 PM

thank you for the replies!
hmm.. I wrote my script as you said...
but take a look at what I got after pressing ESC:

Code:

/ext3/scripts/shell/justtest: line 9: [: : integer expression expected
what is it?

anyway, thank you for the xmodmap instruction! (didn't know about that)
there's valuable info there...

jlliagre 02-22-2005 02:48 PM

What gives
Code:

xmodmap -pk | grep -i escape
?

JoannesX 02-22-2005 04:34 PM

well,
the keycode is 9
and the keysym is 0xff1b
check it

Code:

JOANNES=[Online]=>xmodmap -pk | grep -i escape
      9        0xff1b (Escape)


jlliagre 02-23-2005 04:46 AM

The problem was probably due to my script using nawk vs awk, anyway that should work:
Code:

xmodmap -e "keycode 9 = Space Escape"
dialog --msgbox "This is the text that appears in the dialog" 10 30
xmodmap -e "keycode 9 = Escape"



All times are GMT -5. The time now is 12:25 PM.