[SOLVED] complicated key remap (multiple keys at once)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I recently switched to linux from windows. Been thinking about it for years, but win8 pushed me over the edge. I'm now running mint/cinnamon (gtk+). So far I'm loving it! Only one thing I haven't been able to figure out so far:
On my laptop, the pgup/pgdn/home/end keys are done by Fn + arrow keys. Problem is, only one Fn key, and it's on the other side of the keyboard. Can't pgup/pgdn with only one hand.
In windows I used AutoHotKey to remap the "menu" key, which is very close to the arrow keys. If pressed in conjunction with one of the arrow keys, it was treated as a modifier key, like ctrl, alt, etc. And so I could create the following scripts to make menu+up act like pgup, etc. But if pressed by itself, when the key was released (key up event) it would still open the menu. Like this:
This method would even allow additional modifiers: like if you pressed shift+menu+up, you would get a shift+pgup. Same with ctrl, alt, etc.
I've seen how to do simple remaps in linux, but that doesn't seem to work with anything but the standard ctrl, alt, shift, super modifier keys. Is this menu+arrow thing possible? Been searching for about a week now, no luck thus far. But oh boy, have I opened the menu a million times when I was trying to do home/end/pgup/pgdown! Thanks in advance.
Under preferences open keyboard and then in the tab shortcuts you will see in the botton of the list "custom shortcuts" where you can set it your way. Now if you are already there trying to get it done but no go, then there is the xmodmap program that you run in the terminal, type man xmodmap in the terminal to open the manual.
Also you will need xev another program the runs in the terminal what it does is to capture the keys pressed and give back the codes for the keys, alot info is generated, in the line where you see something like this:
keycode 37 (keysym 0xffe3, Control_L)
is the code and hexa value for the key that you pressed. To know more about xev, type in the terminal man xev.
Yet another way to change it is in /usr/share/X11/xkb/symbols/pc where you can directly edit the keyboard, but would be wise to backup the file(s) before start.
Thanks for the reply; I had already been looking at both of those, as well as autokey and xbindkeys.
Of those solutions, the most promising so far has been xbindkeys; but the problem seems to be that you can only map certain keys to a modifier. IF I could map the menu key to Mode_switch, then I'd be golden. But it won't work. I read somewhere that this is an xorg limitation, not just xmodmap.
However, I may have found a solution, writing a c program using XRecord to monitor key events.
My first try worked, but required me to unmap the menu key and arrow keys, and then use XTest to send either correct key event, depending on whether the menu key was down. But I don't like unmapping my arrow keys; if the program terminates I'm left with no arrows until I change the map or restart the program.
Possible better way: seems like I could just unmap the menu key (135) (actually remap it to like 255 or something). Then when my program sees a 135 keydown/up event, it sends a mode_switch keydown/up event. Hope it works...