Xkb symbols syntax
Freedom of choice through modularity is an ideal in the DreymaR world, as in Linux. See the main Colemak[eD] topic if you're interested. This is my own preferred AltGr mapping layers modifier lv in Linux terminology for the Colemak layout. I've tried to add much functionality while keeping it intuitive. Since the start, there's been some minor tweaks based on my experience and forum feedback, but it's been stable for a long time now. This is what I think of as the Colemak layout per se.
This is My Favorite Mod next to Colemak itself! The ability to navigate and edit from the home position and its immediate surroundings is extremely powerful. It's like having part of the power of advanced editors like Vim ready in all situations. Plus a fully functional multimedia keyboard without sacrificing compactness. And much more. A symbolic chart of my Extend mappings lvl1 only. The Tilde key is customizeable — by default it holds a spare Del but it could be anything you deem useful.
Of course, anything is customizeable really! My mapped keys go a few pixels at a time so when acceleration is on you may travel quickly around the screen this way. Wheel mousing works but doesn't repeat so you'll have to press many times to scroll a long way. You could also use xbindkeys, AutoKey or others to bind whatever you want to these keys. The trick is to press the modifier s before clicking on the shortcut you want to set! Then when 'New accelerator' is showing you press down the final key.
Holding down AltGr you get Extend2a numeric layer laid out pretty much like a standard NumPad but with the top row moved around to fit:. Extend NumPad mappings. Having to hold down both CapsLock and AltGr while entering numbers is hardly ideal. I'd like to use another key but there are few to spare and maybe make it a lock instead of a switch modifier i. Unsure about that, really. But at least, here it is. Actually, one might construct a level7 modifier by combining level3 with level5.
I thought they might be somewhat handy, but the heavy chording required suits the fact that few need them very often! All KeyPad keys are affected by PointerEnable! Or, you've found an extra way of key mousing! For some reason, the Stroke dead key is still broken in my XKB.
Gotta get that fixed at some point maybe it'll be my first Linux bugfix unless someone beats me to it. Furthermore, I'd like to add more mappings that feel intuitive to me such as superscripts on the acute accent key and subscripts on the grave accent key. There's also a whole iota dead key that only concerns itself with Greek characters. I'm tempted to stuff something good into those cracks even if it's not an entirely logical thing to do because the name of the dead key wouldn't reflect these extra mappings.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up. I'm trying to install a custom keyboard layout without sudo access, as I described in Is it possible to use a custom keyboard layout without sudo access?
If so, how? More specifically, the man page for the command gives you the ability to specify a rules file:. Specifies the name of the rules file used to resolve the requested layout and model to a set of component names. However, it doesn't say exactly what kind of file one is meant to put on there, and I'm struggling to make sense of this option. However, I'm not sure at all of how to modify that file.
So: how can I specify a file in the -rules file option that enables me to set my own variant? The main rules file in use these days is actually evdev ; you can see this with setxkbmap :. Parentheses mark a particular clause in the specified file usually variants and options.
XKB tools setxkbmapxkbcompetc can take an argument to search another location for the files, but this custom location must be in the same format as the system database. Here's what the system database looks like.
If you want to override these files or provide your own layouts, without merging them into the system database, what you'll do is create a similar directory structure for your own files. You probably won't need to do anything with geometry or keycodes unless you're building your own keyboards from scratch. Symbol files can include other symbol files but I haven't found an include syntax for rules files. You'll probably have to copy the entire system evdev rules to your local version and add your modifications.
Using custom locations may not be usable with other XKB configuration systems like localectlGNOME's settings daemon, or Wayland compositors that aren't configurable with setxkbmap.
Ubuntu Community Ask!GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. If nothing happens, download GitHub Desktop and try again.
DreymaR's Big Bag of Keyboard Tricks (Linux/XKB files included)!
If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. Skip down a bit if you're only interested in the latter! What keyboard layout do you use? Standard Qwerty, Dvorak, neoColemakor something else? Ease of typing.
I haven't used neo, but both Colemak and Dvorak, after fingers become used to the new workloads, are significantly more comfortable to type on than Qwerty ever was.
This will probably lead to lower error rates and higher speeds when proficient, by the way.
Ease of entering symbols. Most of these have been available in some keyboard layouts for a long time, and others not too hard to enter anyway e. My original reason, though, for customising keyboard layouts, is because, programming, I want to write things like while list[i]! Whichever your reason for switching, you should bear another factor in mind: practicality.
The above explains why I use Colemak, but not what these files are. After a while I found Colemak really nice for typing on, but found myself always reaching for various symbols in wierd positions on the number row while programming. I write quite a bit of code:. Colemak was designed to make English text easier to write; the author didn't try to optimise the positions of symbols.
With that in mind, it shouldn't be surprising to find that someone tries to optimise symbol keys indeed if you read through the colemak forums, you will find several other such attempts. So what was my approach? Of course, the best keys on the keyboard are already taken — we use them for typing letters, not numbers, operators and other symbols.
I took my inspiration from the neo layout: use an extra shift key. It even supports 8 levels per key I think this is mainly used in Cyrillic languages. So all I had to do was activate a second shift key, and add some symbols to the other keys. Oh, and design a keyboard layout. Other variants are quite easy to think of, but since near limitless combinations are possible defining other variants is left as an exercise to the reader see the section below on customising the layout.
So is this layout well optimised in general or more importantly for your usage? The answer isn't obvious but most likely the answer is no : a more optimal layout could be found. However concentrating solely on whether or not this is the best layout is somewhat missing the point: the question you are probably asking is is it worth me learning? Of course, I cannot answer that for you, but I can tell you I find this layout a massive improvement over standard qwerty or colemak, not just for programming but also for writing plain text.
XCompose and restart applications. For GTK applications I think some additional hack is necessary. The first step is very easy: copy the layout file into the XKB layouts directory.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up. It is useful when I want to switch between a Mac or Windows keyboard. The one problem I've encountered is that I have to log out and then log back in after editing the file in order for the edited configuration to take effect.
At least in Ubuntu, this directory wasn't used for this purpose for quite a few years. Ubuntu Community Ask! Sign up to join this community. The best answers are voted up and rise to the top.
Home Questions Tags Users Unanswered. Asked 2 years, 5 months ago. Active 1 year, 7 months ago. Viewed 5k times. Any help would be greatly appreciated. Doug Beney Doug Beney 2 2 silver badges 8 8 bronze badges. XKB probably already knows the differences; you just need to know what to tell it to load.
Active Oldest Votes. Run this command. Of course, you could change "us" to your desired keyboard layout. Does what you say. The key ingredient for me was an additional -variant foo.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Socializing with co-workers while social distancing. Podcast Programming tutorials can be a real drag. Featured on Meta.Needs Updating This article needs updating to include the latest versions of Ubuntu. More info Layouts are kept in the symbols directory therein: they are generally named by a two letter country code associated with the language for which the layout is designed.
Editing a layout is as simple as locating the correct file in the symbols directory and editing the file. If you use other X11 wms you may want to give your layout to the rest of the xorg system.
You can do this by adding the file to the symbols. These steps are currently beyond the scope of this document. Numbers and the standard alphabet may be entered directly. Editing an existing layout For example, supposing I want to add a dead key for the til accent for when I chat to my brasiliano friends. Each line that starts with key gives a definition for that key. The word after key specifies which key, such that the second letter is A for the bottom row, B for the second row, etc, and the number is how far to the right that key is in that row starting at zero.
The function keys follow a different naming formulation, FKand other keys such as the key to the left of the "1" key, may be called TLDE. After that are blocks of generally 4 or less assignments to the key.
What went wrong? I can't find any references for a proper layout so I'm going to be using my personal understanding of haitian to guide the design. This isn't in school, so get over it. There's a whole section, about half of the entire layout, for dvorak typing.
Extending the X keyboard map with xkb
In what remains I need to rename Spain to Haiti everywhere. I need to replace the country code es with ht. And then, the hard work, I need to actually come up with a good key mapping for the haitian language.
You can see there's a lot a whole lot of dipthongs and trithongs, they won't have a one-to-one mapping in unicode I don't think soso we'll just provide each glyph for those letters. There's no non-latin characters or anything special going on, but we want dead keys for the standard accents: grave, acute, diaresis, and caret. They tend to use quotes much as the italians or french do, with Guilemets for antural quotes and double qoutation marks for short, more formal citations or "quote-words".
The country list is a list of which countries should house this keyboard layout -- short list in our case. Likewise with the language list we only needed to put "hat" as it's just for haitian creyole. How to load changes To load changes to the layouts menu simply close out of gnome-keyboard-preferences and reload, relaunching the windows manager should not be necessary.
There is a change in Ubuntu version It looks like changes just don't get applied. The input code is an UTF value.Working through the X KB configuration files is a bit of a chore. In most cases you don't have to. There are perfectly adequate pre-packaged configuration files already present.
However, at the end of the day, you may have to roll your own. Or you may have to understand what's in the files so that you can pick one. The main files are in the keycodestypescompatsymbols and geometry subdirectories, corresponding to the components of the same name. The keymaprules and semantics subdirectories contain ways of grouping the main components together into neat bundles. Basics X KB configuration files are all structured in a similar way. A single configuration file contains information on a group of similar items.
The file can contain a number of variants that contain variations on a theme. Each variant has the following syntax: a set of options, a type and a name, followed by the variant information in braces and a semi-colon. The type describes the sort of information present, eg. The name is enclosed in quotes and contains the variant name, eg.
This information uses whatever keywords and information is appropriate to the type at hand. It is also possible to include information from other files and variants. There are two ways of including information: you can include or augment. If you include, using the syntax include " file variant " -- note the lack of a semi-colon -- then the information from the included file overrides any configuration information that already exists.
If you augment, using the syntax augment " file variant " then the information is only added if it doesn't override something that already exists. In both cases, the file argument is assumed to come from the same base directory as the type, eg. The configuration file syntax also allows inheritance of information wherever possible. Contexts and groupings are enclosed in braces. Information from parent contexts are inherited. For example, in a geometry file, the top level of some geometry might have shape.
This piece of shape information is inherited by any defined shapes, although it can be overridden for a particular shape.
The options set the various levels of visibility and function that each variant shows. Key Codes The key codes files map a keyboard's scan codes onto useful symbolic forms. These files are the first point of contact between a keyboard and the X KB system. After that, things tend to become keyboard independent, focusing on the sorts of symbols that you want to produce and the behaviour that you want out of the keys.
Following that, the minimum and maximum lines give the minimum and maximum key codes that the keyboard generated. If not all the key codes are used, that's not a problem.
These lines associate key codes with the names that will be used in components such as a symbols component. Figure 2: Key Code Naming Conventions The convention used is to explicitly name shift and escape-like keys, but to name ordinary keys by a positional code.
I found that I even can't compile keymaps on my standard Ubuntu machine:. Rules tell XKB how to build keymaps from part, they don't specify a particular keymap. The input of xkbcomp needs to be a keymap. The easiest way to figure out what the input should be is to read the man page haha no read the official documentation as if read the misleadingly named Unreliable guide which is so good it's linked on the semi-official X.Taking a Look at Sysctlview 2.0 on FreeBSD 12.1
Oh, you just did that. Well, xkbcomp works both ways. So if you just ask it to decompile the keymap from your display, you'll see some acceptable input.
You can use an include statement to tell xkbcomp to read existing files. For example, to use the US layout with Compose on Menuuse. You can ask setxkbmap to produce acceptable input for xkbcomp. Pass the -print option to see the output rather than push the keymap to the server. Actually, I lied by omission above, there's an easier way: the information is on the Arch wiki.
If you like understanding how to configure your system, the Arch wiki is an excellent resource, whether you're using Arch Linux or not. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered.
How does xkb compilation work? Ask Question. Asked 1 year, 10 months ago. Active 1 year, 10 months ago. Viewed times. How is xkbcomp supposed to be used? Gilles 'SO- stop being evil' k gold badges silver badges bronze badges. Martin Martin 23 3 3 bronze badges. Sorry, the error message would have been helpful - added now. Active Oldest Votes. Gilles 'SO- stop being evil' Gilles 'SO- stop being evil' k gold badges silver badges bronze badges.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.