4

I'm currently using xmodmap to remap some keys, keeping my configuration in a .Xmodmap file, but every time I boot my laptop, or my screen locks, the customization is lost and I have to run xmodmap ~/.Xmodmap once again, even though I set the command to execute on startup and in the ~/.xinitrc file too.

I've rummaged about forums looking for information on setxkbmap, but I can't really understand what's going on, and have trouble trying to remap some keys.

For example, the key on the right of my Right Alt key, when pressed under xev, looks like this:

KeyPress event, serial 37, synthetic NO, window 0x2600001,
    root 0x6a8, subw 0x0, time 14892208, (674,389), root:(848,553),
    state 0x0, keycode 97 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

1 - So we have keycode 97 and keysym NoSymbol. How would I map that to be Right Control using setxkbmap?

2 - Also, how can I remap the Ctrl + Arrow Keys to work like Home / End / PgUp / PgDown?

Most importantly, I want to make these changes permanent.

3 - Lastly, is there any comprehensive content or documentation about this program out on the web?

Thank you very much for your time and attention.

1 Answer 1

3

I don't have enough reputation to leave a comment. The following AskUbuntu question has an accepted answer (that references xmodmap) and other answers which have some good feedback, which may answer your question (even if:

https://askubuntu.com/questions/749660/how-can-i-persistently-remap-keys-in-ubuntu-16-04

For your other questions, not using setxkbmap, but using xev and xmodmap , I posted some useful information tonight on https://unix.stackexchange.com/a/727560/282315 which might answer most of these.

For full documentation, you can type in to a terminal man <PackageName> e.g. man xmodmap

As these are SE sites, I'm not going to copy the information to this answer, to keep the original answers in their original question.


For the key combinations, you could have a look at Menu >> Keyboard. There's a 'Shortcuts' section where you can create your own. I'm not sure a Ctrl+Up/Dn can work to do PgUp/PgDn, you might need to look at using macros (like AutoKey sudo apt install autokey-gtk - desktop automation utility). But if you currently have to press a function key to get the PageUp (e.g. Fn+Up), there should be a Function Lock key to reverse the functions if you use them all the time, it could be a padlock that you Fn+Lock and it switches them around.

1
  • Autokey is usually great for things like this, but I don't think it will accept the arrow keys as part of hotkey/shortcut. I gave that a quick try and it didn't work. If you're determined to pursue this, take a look at interception-tools. Maybe that would work.
    – Joe
    Feb 8, 2023 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .