How to create your very own keyboard layout

Search for a command to run...

No comments yet. Be the first to comment.
Remember my post about switching to VSCode? Well, plot twist: the very next day after publishing it, I switched to WebStorm. And guess what? I've been on JetBrains IDEs ever since. I know, I know. Another "why I switched editors" post. But hear me ou...

I had been doing some basic interpreter work in Go and wanted to redo it in another language to solidify my understanding. Naturally, I chose Odin, it’s another great language, with a Go-like, easy-to-approach syntax and no unnecessary complexity. I ...

Why Emacs Keybindings? I've always preferred Emacs-style editing, especially the way it handles cursor movement and text manipulation. Even though I have switched to using VSCode for most of my development work, I often found myself missing the intui...

In my previous post about building C/C++ projects with CMake, I shared a simple CMakeLists.txt setup for compiling a basic project. Today, I’ll dive into a specific need that many developers encounter: linking libraries directly from project folders ...

Some time ago, I wrote a post about using Vim to look cool and why that’s not a good idea. Now, funny enough, here I am—having switched to VSCode after years of hopping between Vim and Emacs. This isn’t one of those "Vim sucks, I'm going back to VSCo...

Create a new file in the /usr/share/X11/xkb/symbols/ directory. You can name the file anything you like, but it's recommended to use a name that reflects your new layout.
For example, you can create a file called "mydvorak" by opening a terminal and typing the following command:
sudo gedit /usr/share/X11/xkb/symbols/mydvorak
In the new file, define your new layout. You can use the existing dvorak layout as a starting point, and make modifications as needed.
Here's an example of a modified dvorak layout that makes the symbol positioning easier for people coming from qwerty.
// My custom Dvorak layout
partial alphanumeric_keys
xkb_symbols "basic" {
include "us(dvorak)"
key <AE11> { [ minus, underscore ] };
key <AE12> { [ equal, plus ] };
key <AC11> { [ slash, question ] };
key <AD11> { [ bracketleft, braceleft ] };
key <AD12> { [ bracketright, braceright ] };
key <BKSL> { [ backslash, bar ] };
};
Save the file and exit the editor.
Edit the /usr/share/X11/xkb/rules/evdev.xml file to include a reference to your new layout.
I added the following next to all the dovrak entries
<variant>
<configItem>
<name>mydvorak</name>
<description>mydvorak</description>
</configItem>
</variant>
Restart your computer to apply the changes.
How to switch keyboard layouts
you can use the setxkbmap program to change the keyboard layouts.
I have setup the following aliases to switch back and forth between the qwerty vs mydvorak layout.
alias asdf="setxkbmap -v mydvorak"
alias aoeu="setxkbmap -v us"