On Sun, 2016-09-25 at 13:44 -0500, Bowen Wang wrote:
Hi Adam,
I have solved the keyboard remap problem. I will post my solution here.
I used to use the xmodmap, but it doesn't work in Wayland anymore. So I dig
into the xkb, I found two webpages particularly helpful.
https://wiki.archlinux.org/index.php/X_KeyBoard_extension
http://www.charvolant.org/~doug/xkb/html/index.html
After reading these webpages, I have solved my problem. But my solution has
its limits, I think it can only handle keyboard remap, but if you want to
add some more advanced stuff on it, I don't think it will work.
To remap the keys, go to the directory:
/usr/share/X11/xkb/keycodes/
The files are mappings from key code that sent from keyboard hardware and
the key names that actually prcoessed by the X system. For example,
<LALT>=64
This means that when X system received the keycode 64 from the keyboard, I
will map it to the left alt key in the X system, and sent <LALT> to other
programs in X to get the functions about that key. So the solution is
pretty simple, suppose that you want to swap Left Ctrl and Left Alt, the
original configuration file is like this:
<LALT>=64
<LCTL>=37
What you need to do is just change it into:
<LALT>=37
<LCTL>=64
then restart the laptop.
Glad you figured something out! However, you will probably want to
research a bit further.
As a general rule, it's almost never correct to make a local
configuration modification by editing a file in /usr . Files under /usr
are usually owned by distribution packages and changes to them will not
be preserved when the package is updated. So in this case, we can see:
[adamw@adam tmp]$ rpm -qf /usr/share/X11/xkb/keycodes/evdevÂ
xkeyboard-
config-2.18-1.fc25.noarch
that file is owned by the xkeyboard-config package, and whenever that package gets an
update, your edits to it will be overwritten.
If you keep researching on xkb, you should find a way to make your changes in a file under
/etc (where system-wide local configuration is stored, by convention) or your home
directory (where user-specific location configuration is stored).
Good luck!
--
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net