Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to use .Xdefaults file for keymaps

Posted on 2006-06-24
4
Medium Priority
?
433 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Author Comment

by:bryanlloydharris
ID: 16974562
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 1400 total points
ID: 16974890
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
ID: 16975092
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
ID: 16975826
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

722 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