<HTML ><HEAD ><TITLE >More Hacking</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="HOME" TITLE="Linux Backspace/Delete mini-HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="What If Nothing Works" HREF="notwork.html"><LINK REL="NEXT" TITLE="Conclusions" HREF="concl.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Linux <B CLASS="KEYCAP" >Backspace</B >/<B CLASS="KEYCAP" >Delete</B > mini-HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="notwork.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="concl.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="MOREHACK">8. More Hacking</H1 ><P >So, you're not happy with the information you got. In this case, there is even more hacking you can do on the Backspace/Delete issue, using suitable commands that get or set the way X and the console handle keys.</P ><P >It could happen that, for some reason, what I said talking about <A HREF="x.html" >X</A > is not true, that is, X does <EM >not</EM > translate keycode 22 to keysym <SPAN CLASS="KEYSYM" >BackSpace</SPAN > and keycode 107 to keysym <SPAN CLASS="KEYSYM" >Delete</SPAN > (or even that, on your particular keyboard, the keycodes associated to <B CLASS="KEYCAP" >Backspace</B >/<B CLASS="KEYCAP" >Delete</B > are not 22 and 107). To be sure of that, you need to use <B CLASS="COMMAND" >xev</B >, a simple X application that will display the keycode and keysym associated to the key you press. If anything goes wrong, there are several ways you can fix the problem: the easy, temporary way is to use <B CLASS="COMMAND" >xmodmap</B >, a command that lets you change many settings related to X keyboard handling. For instance, <TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >xmodmap -e "keycode 22 = BackSpace" xmodmap -e "keycode 107 = Delete"</PRE ></FONT ></TD ></TR ></TABLE > will set correctly the keysyms (assuming that 22 and 107 are the correct keycodes for you). In case you want to do some changes permanently, you can play with the resources <TT CLASS="VARNAME" >vt100.backArrowKey</TT >, <TT CLASS="VARNAME" >vt100.translations</TT > and <TT CLASS="VARNAME" >ttyModes</TT > of <SPAN CLASS="APPLICATION" >xterm</SPAN > (and similar terminal applications) in the configuration file <TT CLASS="FILENAME" >~/.Xdefaults</TT >. One possibility, for instance, is <TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="PROGRAMLISTING" >XTerm.VT100.Translations: \ <Key>BackSpace: string(0x7F)\n\ <Key>Delete: string("\033[3~")</PRE ></FONT ></TD ></TR ></TABLE > You should take a look at the <SPAN CLASS="APPLICATION" >xterm</SPAN > man page for more information.</P ><P >The program that does for the console what <B CLASS="COMMAND" >xev</B > does for X is <B CLASS="COMMAND" >showkeys</B >: it will dump the console keycodes of the keys you press. Combining <B CLASS="COMMAND" >showkeys</B > with <B CLASS="COMMAND" >dumpkeys</B >, which will print on standard output the console keymap, you can easily fix mismatches between keycodes and keysyms. Analogously to <B CLASS="COMMAND" >xmodmap</B >, <B CLASS="COMMAND" >loadkeys</B > can then fix single associations, or load entirely new console keymaps. With it, you can even change the string associated to a given keysym. If you want to record these changes, you will have to define a new keymap for the console (you should have a look at the system keymaps, usually located in <TT CLASS="FILENAME" >/lib/kbd</TT >).</P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="notwork.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="concl.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >What If Nothing Works</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Conclusions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >