LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Getting keyboard to function properly in rxvt/urxvt (http://www.linuxquestions.org/questions/slackware-14/getting-keyboard-to-function-properly-in-rxvt-urxvt-730759/)

Cotobear 06-04-2009 06:44 PM

Getting keyboard to function properly in rxvt/urxvt
 
Hey everyone,

I have installed urxvt (rxvt was installed with the system).

Currently xterm properly uses the keyboard, that is, all the keys do what they should. However rxvt and urxvt both fail to use the home and end keys properly and instead produce a "~".

What is the best solution for this? Since the keyboard is functioning properly for xterm is it possible to link the settings that xterm uses to a file that urxvt/rxvt uses?

Any advice is appreciated,
Coto

rigelan 06-04-2009 11:12 PM

Funny, I was working on this exact problem today, but then I got distracted. Haven't come up with a solution yet.

rigelan 06-04-2009 11:28 PM

Well, one solution that I came up with to fix urxvt was creating a file in the home directory for my user:

Code:

~/.inputrc
 "/e[7~": beginning-of-line
 "/e[8~": end-of-line

This makes it so that urxvt (rxvt-unicode) works when the HOME key and END key are pressed. It attaches the key "[7" to the command "beginning-of-line" and key "[8" to the command "end-of-line"

Unfortunately, it breaks the other terminal I use: the linux terminal on tty6, where the home and end keys stop working. In that terminal they use keys "/e[1~" & "/e[4~" respectively.

Does anybody have a solution that would make them both work properly? I will continue to look for one.

dangazda 06-05-2009 07:08 AM

Hi,
I had similar problem and added something like :
Code:

case "$TERM" in
        rxvt*)
        bindkey '\e[7~' beginning-of-line
        ;;
        linux)
        bindkey '\e[1~' beginning-of-line
        ;;
esac

to my ~/.zshrc. I didn't test if for bash, so please take it as a hint only ... (e.g. in bash bindkey->bind, I think)

Daniel

rigelan 06-05-2009 10:52 AM

Thanks for the tip dangazda, unfortunately it looks as though bindkey doesn't work in bash.

I did end up with a fix for mine, by putting both keys into ~/.inputrc,

Code:


"\e[1~": beginning-of-line
"\e[7~": beginning-of-line
"\e[4~": end-of-line
"\e[8~": end-of-line

Because the key codes don't contradict one another and are completely independent, I can get away with this.

How is your problem looking cotobear?

rigelan 06-05-2009 11:12 AM

I changed something again. When I did the last command, it made home and end key work properly, but the page-down and page-up, and delete key stopped working. I think the ~/.inputrc completely replaces the commands in /etc/inputrc, instead of just adding to them. So I took the /etc/inputrc file, made a few changes to it, and copied it to ~/.inputrc. I didn't just make the changes in /etc/inputrc because it is part of a system file, and whenever I upgrade the package, the changes I placed in it would disappear.

-It might make sense for the package maintainer to make this change in /etc/inputrc.

Here is my latest ~/.inputrc (copied and changed from /etc/inputrc)

Code:

# /etc/inputrc - ~/.inputrc
# This file configures keyboard input for programs using readline.
# See "man 3 readline" for more examples.

# Configure the system bell.  Options are none, visible, and audible.
#set bell-style none

# Enable 8 bit input.
set meta-flag On
set input-meta On
set convert-meta Off
set output-meta On

# Set various nice escape sequences:
"\eOd": backward-word
"\eOc": forward-word

# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert

# for rxvt                    #added
"\e[7~": beginning-of-line     
"\e[8~": end-of-line         

# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line


Cotobear 06-06-2009 02:40 PM

Hey rigelan,

This has also worked for me. I tried just putting the keycodes in /etc/inputrc without luck. Copying /etc/inputrc to ~/.inputrc has solved the problem.

Additionally, a source for your (experimentally confirmed) idea that the local file replaces the global file:

http://www.linuxfromscratch.org/blfs...s/inputrc.html

Thanks for your suggestions.

Coto


All times are GMT -5. The time now is 04:43 AM.