Solved

how to use .Xdefaults file for keymaps

Posted on 2006-06-24
4
408 Views
Last Modified: 2008-02-01
Hi,

In the xterm man pages I can see the following text towards the end.  It seems that X should insert the text (i.e. next, step, continue, etc.) whenever I press the F-key.  However, when I add this code to my .Xdefaults and then run "xdrb -merge .Xdefaults" I am not able to press the F-key.

In my config I changed the F-keys to something lower, such as F7, but it still did not work.

           *VT100.Translations: #override <Key>F13: keymap(dbx)
           *VT100.dbxKeymap.translations: \
                <Key>F14: keymap(None) \n\
                <Key>F17: string("next") string(0x0d) \n\
                <Key>F18: string("step") string(0x0d) \n\
                <Key>F19: string("continue") string(0x0d) \n\
                <Key>F20: string("print ") insert-selection(PRIMARY, CUT_BUFFER0)

Can someone please tell me how to enable this?  I would like to press the F-key for doing commands.

0
Comment
Question by:bryanlloydharris
  • 2
  • 2
4 Comments
 
LVL 3

Author Comment

by:bryanlloydharris
Comment Utility
Here is what happens when I press the F-key a few times.  It just types 8~ instead of typing the desired text.

$ 8~8~8~8~8~8~
0
 
LVL 22

Accepted Solution

by:
pjedmond earned 350 total points
Comment Utility
I found this particular issue rather annoying. I can get it to work in twm, but not in gnome or kde!...so I'm also missing something atm. You may wish to have a look at this package though, which appears to encompass everything:

http://www.shallowsky.com/software/crikey/

Which provides the funcrtionality you are after with instructions for different environments, and worked relatively easily for me.

(   (()
(`-' _\
 ''  ''

0
 
LVL 3

Author Comment

by:bryanlloydharris
Comment Utility
Hi, I actually figured it out with great effort.  It's just that the X resources database is difficult for me to understand.

I was starting to wonder if I could send similar strings to firefox when I read your answer --- thanks for the tip!  I will probably end up throwing out the use of .Xdefaults and just stick with crikey if it works for me.  Have you had good experience with it?

Anyway, if you're curious, here is the final result of my efforts.  With the following code in .Xdefaults you must _first_ press F1 to "activate" the other lines of code --- at least that's my basic understanding.  Once you have pressed F1, you may press one of the other combos and its associated string will be inserted on the xterm CLI.

I thought it would be cool if I could type something like *firefox.Translations: to do a keymap in firefox but I'll just leave that in the back of my mind for later.  It also doesn't really seem worth looking up if that crikey program ends up working.

What I had to do to get it work was:
0) create the .Xdefaults file and put in the code
1) run "xrdb -merge .Xdefaults"
2) close my xterm
3) open a new xterm
4) press F1
5) then press one of the others and voila it worked.

*VT100.Translations: #override <Key>F1: keymap(function)
*VT100.functionKeymap.translations: \
    <Key>F2: string("some string here\n") \n\
    <Key>F3: string("another string here\n") \n\
    <Key>F4: string("and yet another string here\n") \n\

0
 
LVL 22

Expert Comment

by:pjedmond
Comment Utility
Never used crikey before today - Was gradually ripping out my hair trying to get it to work and found this little utility (with reasonably clear instructions). Got what I wanted working in about 10 mins:) Thanks for your explaination - I can get it working on my system with the .Xdefaults now - but it's a bit fiddly....but then again, it's probably something that you'd normally only do once!

Many thanks for the points

(   (()
(`-' _\
 ''  ''
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now