Adjust keybindings

My situation: I have a German keyboard which is also fine for English, but I also often write texts in Spanish and use quite a lot of Greek letters and symbols.

Of course, there are tools for selecting special characters and there is also the option to switch keyboard layouts with a mouse click or a hotkey, but I think both are pretty cumbersome solutions.
Instead, I’d rather like to add certain symbols to my keyboard, i.e. modify the existing bindings in a way that missing letters or symbols can be entered without hassle.

After doing some research and trying out several ways to achieve that, the only really practical way to achieve what I wanted was to edit /usr/share/X11/xkb/symbols/XX where in my case XX stands for de.

My keyboard looks like this now (not physically, in reality, there’s a number block and some special keys are in slightly different places):

So, now e.g. I have AltRight + n = ñ and Shift + AltRight + n = Ñ
By this way I can now easily type mixed sentences like
“¿Te acordás del café sobre Kurfürstenstraße?” without pulling up some character-select tool or switching the global layout.

Now to my question: Is there an app that makes customizing keyboard layouts simple?

I imagine it like this: When opened, the tool reads the current configuration and offers you the choice to either edit the current layout or to create a new one on base of the current one.

It will then show a map of the keyboard and by entering a key combination it should offer you the possibility to assign an arbitrary letter or symbol from an easy to browse list.

I could surely program such a tool myself, but it would be quite some work and I don’t feel like reinventing the wheel.

Finally, my two questions are:

  1. Is there a tool like I describe? I couldn’t find one.
  2. If not, would other people have interest in such a thing?

About 2 years ago, I was asking the same questions. I have found only very few programs (I only remember 2, but perhaps it was 3 in total) that could even remotely fit into what I was looking for. First I tried this convenient tool. I don’t remember what was wrong with it, but something I really needed did not work with it, even though it looked promising.
The last resort solution I came to, which actually works, but is really antiquated is the following tool. Even back then, when that guy wrote this program, xmodmap was so inconvenient on its own, that even that professional developer had trouble remembering and figuring out the syntax for xmodmap. Needless to say, yes this guy’s program is still ages old. It pretty much never was updated since 2 or almost 3 decades. But it works (almost). When it does not work, you can invent workarounds, which worked for me. I just had to fiddle around with it enough to make the layout I needed.
It’s a terribly old tool, but it’s the only one I found that enables you to create or edit advanced layouts.
So just from the perspective of how scarce this type of software is, someone perhaps might recommend it, but if you just look at the software on its own, I would actually recommend against it. I don’t remember much about what I did 2 years ago, but I remember this whole layout thing being a huge pain in the ass (on Linux; on Windows it was fine and easy).

All that said, I suggest you have a look at the following, before you dive into any advanced layout editing.

It’s one of the best layouts I have ever seen and while it’s mainly targeted at German speaking users, the newest version might just as well be used by anyone, due to its extensiveness. It also depends on one’s use case, though.

P.S.: I wanted to make a fork of klidsaz and make it work properly, but I never could get myself to actually do it. From all languages I know, I hate Python the most. There is only one thing I hate more. Python 2.

@Akito Thank you so much for providing your links! I will certainly have a look at Klidsaz. Perhaps it works for my purposes.

I have tried XkeyCaps and, aside from the gruesome look, I did not really manage to make it do what I wanted. Might be my own impatience’s or incompetence’s and not the program’s fault but in the end, for the purpose of just changing a few keys, I found it easier to directly work with the text files which define the different keyboards. The result you see above.

Regarding the Neo Layout: It’s certainly good for fast typers, but I am definitely not one of them. So I won’t use it, also not the Dvorak variants. Despite using all fingers, I still need my occasional glance at the keyboard, although on my laptop I have the Swiss variant, without ß, where typing upper case umlauts requires some acrobacy and with some punctuation and special signs in different places but my fingers remember their correct position, so it looks Swiss but is German with my personal enhancements.

As far as possible implementations for a tool I might program go, I totally agree with you, that Python is awful. However, tk as for Tcl or Perl is totally outdated. The framework to write the GUI in, would be Qt which is well supported in Python but not in other scripting languages as Perl-Qt never really took off and nobody (besides me and a few other remaining adepts) really likes Perl any more.

That leaves either Python or C++ for implementation. Especially the latter would take me well too many hours.

The easier variant for implementation would be an online tool where you could create and subsequently download your own files based on all the existing variants stored in a database. GUI creation for web apps is just so much easier than for real programs. I guess, this would rather be the way I’d go.

I program my keyboard keys with Autokey in Linux, and AutoHotkey in WIndows. With planning, one can do anything with either software