If you need to write in multiple languages, use certain symbols or if a key breaks, you can customize your keyboard map with xmodmap
.
To edit the keyboard map, open ~/.Xmodmap
with your favorite editor (e.g. vim ~/.Xmodmap
).
Example: Add accented letters
The accented letters (e.g. scircumflex Scircumflex) appear when you press alt gr. Therefore to write ŝ you press s + alt gr and to write Ŝ you press s + shift + alt gr.
This example uses Esperanto letters.
keysym s = s S scircumflex Scircumflex scircumflex Scircumflex
keysym g = g G gcircumflex Gcircumflex gcircumflex Gcircumflex
keysym h = h H hcircumflex Hcircumflex hcircumflex Hcircumflex
keysym j = j J jcircumflex Jcircumflex jcircumflex Jcircumflex
keysym c = c C ccircumflex Ccircumflex ccircumflex Ccircumflex
keysym u = u U ubreve Ubreve ubreve Ubreve
Find keysyms of accented letters
Here is a list of all keysyms: http://wiki.linuxquestions.org/wiki/List_of_Keysyms_Recognised_by_Xmodmap
For example to use ö, Ö you need to add odiaeresis and Odiaeresis to your keyboard map, or to use é, É add eacute and Eacute.
Example: Remap broken keys
If a key is broken you can still use it by mapping it to an unused key, such as forward, windows or options.
Remap left/right arrow keys to forward/back keys:
keysym XF86Back = Left
keysym XF86Forward = Right
.
Remap tab to windows key:
keysym Super_L = Tab
Find keycodes and keysyms
To find the keycode or key name, enter xev
command and press the desired key. The output shows like this (for windows key):
KeyPress event, serial 48, synthetic NO, window 0x3800001,
root 0x9c, subw 0x0, time 100000000, (000,000), root:(000,000),
state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
The relevant part is keycode 133 (keysym 0xffeb, Super_L)
which means that you can use either keycode 133
or keysym Super_L
to remap the key in xmodmap.
Use xmodmap
To use your new keyboard map enter the following command:
xmodmap ~/.Xmodmap
To automatically apply your new keyboard map on login, add xmodmap ~/.Xmodmap
to ~/.xinitrc
e.g. with echo 'xmodmap ~/.Xmodmap' >> ~/.xinitrc
To remove the keyboard map use the command setxkbmap -option
If you found this guide useful, feel free to send a contribution to 1CaLCR5mGwS4FJzU1HZm9qwr5WoRYFDdyB (BTC).
This article was written by Web4Crypto. Web4Crypto offers web development, web design, programming and scripting services from $40 and accepts Bitcoin, Monero, Ethereum and other cryptos. Visit https://web4crypto.xyz for more information and a free consultation.