Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have an internet keyboard, and subsequently have a bunch of extra keys for volume, play controls, etc.. So I wanted to learn to map these keys, and start with the volume controls. I have ran xev - and learned that the volume wheel has two key codes, one going up and one down. So how would I map these key codes to aumix -v +10 and aumix -v -10? (although I would use the same format to map all the other keys I wanted I suppose) I just want to A) learn to do this, and B) pimp out my X so nothing is using the mouse to launch things and whatnot.
I suppose another part of this question is what's the difference between mapping keys for fluxbox, and mapping keys for all of X. See, things like volume control should be in all of X (/etc/xorg.conf?) and things like launching apps should be within fluxbox. I only know this because my 'nix savy friend is bragging about how he never launhes anything from a menu anymore. Then he wouldn't tell me how.. lol. Any ideas? -Bill
That's a pretty cool app, but I was wondering about the way to manual do it all. I was really trying to learn how most people add in key functions. Say, what is the procedure for binding a key to a command?
there is non that i know of, as far as i can tell, X doesn't bind keys to events, you need a extra program running to listen for those keys, and that program will bind keys to functions
There are many other post here on the subject as well. If you every figure out the question I asked in the last post let me know. I myself like writing the scripts and then using the khotkeys in the Control Center of KDE to finsih the work. I guess I am getting lazy in my old age.
I have been trying to do something similar, and think this is how to do it.
The first step is to find out the keycode for the key you want to put a new function on. This will be one number, even if the key can send multiple characters. You do this very simply: run xev and then hit the key. There will be two entries, one for the depress and one for the release, and they will have the same keycode.
Next, you have to find out what the keysym is for the command you want the character to send. I only know how to do this for keys that already work someplace on the keyboard, and that is to depress them, also using xev. I think if you look up the xmodmap manual, there is a way to associate commands with keycodes. Or there may be other ways of looking up the exact names for keysyms. For example, the double inverted comma is called 'quotedbl' whereas the single one is called 'apostrophe'. You have to get these names exactly right.
Next you create a text file, and this is in the form
The result will be, that keysyname1 will become the result when the key is pressed without a shift, and keysymname2 will become the result when it pressed shifted. The last two possibilities, 3 and 4 are with other modifiers pressed - the xmodmap manual page explains.
Now you open a terminal, become su -, and run
xmodmap [full path to text file].
Lo and behold, the keys will now do just what you told them to do.
Suppose you have a disaster when doing this, and suddenly find half your keyboard no longer works, which happened to me. You then open your hardware configuration panel and set the keyboard back to what it was. In Mandrake this is part of HardDrake, in Suse you use the X configurer. No idea what you do in the less graphical distros. But find out before starting!
It is in fact really simple once you understand what to do. It takes hours however for the naive to figure out exactly what to do.
I have not yet verified that changes done like this survive reboots, but getting xmodmap to do this at startup must be pretty trivial if not.
I made the two scripts in /opt/volumekeys, but it seems like they aren't executable. I'v e tried /opt/volumekeys/volumeup and just volumeup in the command line, but they don't work. I do xmodmap /etc/X11/Xmodmap and it gives me an error.
A side note - the command 'sh /opt/kde/volumekeys/volumeup (or volumedown)' works!
However in the xmodmap file when I do xmodmap /etc/X11/Xmodmap (the lcoation of my file) it gives me the error 'Bad keysym name in keysym list' and it tells me whatever I put in. eg; Keycode 176 = sh /opt/volumekeys/volumeup the error is 'Bad keysym name in keysym list sh; Bad keysym name in keysym list /opt/volumekeys/volumeup'
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.