Editing
Xmodmap
(section)
From Deskthority Wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==xmodmap specific configuration file== xmodmap configuration file does not need to be concise however when dealing with multiple keyboards that have different layouts for certain keys, it is best to write a concise configuration file that way there would be no erroneous setup. Remember, the concept of "garbage in, garbage out" can also apply here. When writing a configuration file there is no real need to be a specific layout (apart from using the correct syntaxes) to be set. However keeping a nice format of a xmodmap configuration file would not only be beneficial to a single person should they for instance share their xmodmap configuration file around. xmodmap configuration file can be simply put into two groups for simplicity sake. The first group would be the keycodes and their specific output followed by shifts, locks, controls and mods (modifiers). Modifiers are particularly handy for using keyboard modifiers to achieve a specific output. An example of this would be to use a Alt key to mimick AltGR behaviour so when for instance one holds down the AltGR key and presses the letter '''u''' on the keyboard (with the exact same keycode) it would appear on the screen as '''ü''' instead. However, modifiers will only work in combination of one modifier key at a time. If one wants to bind <tt>Ctrl+Alt+A</tt> to output as '''å''', it will not work. Up to five modifiers can be defined (shift keys for instance are an exception and as such cannot be used in the same manner as modifiers would work). By default the first "set" of commands from the keycode would be using the very first modifier. This does not mean that in order for one to type out the letter '''a''' they would need to hold Alt for instance in order for the machine to be able to produce the letter '''a''' on the screen. Rather as such the first set of modifiers would not only define the default behaviour of the keycode when received by the machine but when that first set of modifier is defined as such it would also output as it is. This is why in most default cases for the first set of modifiers are usually set as Alt keys. For example, one wants to type the letter '''o''' on the keyboard, it would output as '''o'''. When setting the first modifier (mod1) to left Alt the output would still be outputted as '''o''' regardless if left Alt was held down or not. Again this is beneficial in cases where one wants to type out '''ö''' for instance they would be normally using the right Alt (mimicking AltGR behaviour) to output as intended and to not confuse programs that the first set of modifier is defined as '''ö''' which would most likely break the default behaviour of most programs. Locks, controls are more or less the shifts in terms of default behaviour. That is when holding down either of the Shift keys, it would capitalise the letter being outputted. However one can redefine such cases if need be. Locks are lock keys such as Caps Lock, Num Lock and Scroll lock. Controls are both left and right Control keys respectively. Ideally when rebinding certain default behaviour of such groups of keys (whether it would be Controls, Shifts or Locks) it is best to not have the same key being defined in both their respective area as well as within the Modifiers area. Here is an example of a xmodmap config file truncated for brevity: keycode 8 = keycode 9 = Escape NoSymbol Escape keycode 10 = 1 exclam 1 exclam keycode 11 = 2 quotedbl 2 quotedbl keycode 12 = 3 numbersign 3 numbersign keycode 13 = 4 dollar 4 dollar keycode 14 = 5 percent 5 percent keycode 15 = 6 ampersand 6 ampersand keycode 16 = 7 apostrophe 7 apostrophe keycode 17 = 8 parenleft 8 parenleft keycode 18 = 9 parenright 9 parenright keycode 19 = 0 kana_WO 0 kana_WO keycode 20 = minus equal minus equal keycode 21 = asciicircum asciitilde asciicircum asciitilde keycode 22 = BackSpace NoSymbol BackSpace keycode 23 = Tab ISO_Left_Tab Tab ISO_Left_Tab keycode 24 = q Q q Q keycode 25 = w W w W keycode 26 = e E e E keycode 27 = r R r R ... keycode 255 = add shift = Shift_L Shift_R add lock = Caps_Lock add control = Control_L Control_R add mod1 = Alt_L Alt_R add mod2 = Num_Lock add mod5 = Scroll_Lock In this case the example of the structured output is basically: Base Shift Alt_Gr Shift+Alt_Gr Compose(?) Shift+Compose(?) keycode ?? = ? ? ? ? ? ? * Base is the character for X to emit when the key is pressed alone. In the example of above where keycode 27 is bound to the letter "r" pressing the key that emits the keycode "r" will emit just "r" on the screen. * Shift is the character for X to emit when the key is pressed along with holding Shift key. In the example of above where keycode 27 is bound to the letter "r" with the subsequent level of "R" to be printed will print out "R" on the screen instead of "r". * Alt_Gr is the character for X to emit when the key is pressed along with holding Alt_Gr key. In the example above it is not different to just pressing the base key but however when a keyboard is defined to have dead grave key functionality, it would print out whatever it is defined in either one's xmodmap configuration file or otherwise whatever is defined as per default on one of the XKB's keyboard maps. Should one compile a custom XKB map to use Alt_Gr keys for instance, the mapping for that will be used so long as it has been loaded. Normally Alt_Gr functionality is disabled by default. * Shift+Alt_Gr is the character for X to emit when the key is pressed along with holding both Shift and Alt_Gr key. Again this would not be enabled by default unless '''XKB''' has been notified to use a keyboard layout that bears Alt_Gr functionality along with specific indications to bind a key in order to enable Alt_Gr. * Compose is the character for X to emit when the key is pressed along with pressing the key reserved for Compose. At this point in time of writing, it is uncertain whether or not this last "group" of keys (Compose and Shift+Compose) is actually know as such however according to HaaTa whom referenced the various Xorg documentation; it is known as Group 5. For keepsakes a Compose key is noted instead. Again, Compose key cannot be activated nor used without XKB being notified to use a keyboard layout that has Compose key. * Shift+Compose is basically what is written as per above for Compose key. In theory, it is possible to have up to eight layers in this specific setup. For instance one could have: keycode 27 = r R paragraph registered Right Redo Which basically implies: * Pressing the key that emits 27 emits "r". * Holding Shift key whilst pressing the key that emits 27 emits "R". * Holding Alt_Gr key whilst pressing the key that emits 27 emits the character "¶". * Holding Shift and Alt_Gr key whilst pressing the key that emits 27 emits the character "®". * Holding Compose key whilst pressing the key that emits 27 tells X to either go forward in character or do something in related to the arrow right key that a program has assigned the right arrow key to perform. * Holding Shift and Compose key whilst pressing the key that emits 27 tells X to Redo something that was undone usually. TODO (expand)
Summary:
Please note that all contributions to Deskthority Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
Edit source
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Deskthority forum
Support Deskthority
Search
Main categories
Guides
Keyboards
Keyboard switches
Keycaps
Keyboard modding
Pointing devices
Brands & companies
Group buys
Other topics
Wiki info & links
Recent changes
Random page
All pages
Deskthority wiki help
MediaWiki help
Tools
What links here
Related changes
Special pages
Page information