“Our nation’s destiny will be determined by our Alphabet!”

~ Nguyễn Văn Vĩnh ~

« tiếng Việt »

updated: 2022-12-26

I spend most of my time writting so naturally setting my keyboard is something that I must put my mind into. In June 2021, I switched to use GNU/Linux. My life really changed after this event. One of first thing that I did was to find ways to type Vietnamese.

There are three ways to approach typing Vietnamese in GNU/Linux:

  1. Use VIM to type everything.
  2. Use a software like ibus-unikey - newer.
  3. Setup the vietnamese keyboard for X11. - older.

I think VIM is the greatest application that human has ever created. But Method(0) require quite a bit of setting up and it really is not very convenient to jump around between applications just to type Vietnamese. Even though this method is pretty fast for writting, VIM is really just the wrong tool for the job. After sometime of hopping around like a frog on steroid I decided to look for other ways.

Method(2) uses X Window System

I went for the Method(1) first because it was more familiar.

Method(1) allows users to type heiroglyphic languages like Chinese, Korean, Japanese…. The big advantage is that you don’t need to relearn how to type Vietnamese. More over, this method uses less key strokes because the software automates a lot of the accents.

Now, I have switched to use the Method(2) for these reasons:

  1. I only ever type Vietnamese and English.
  2. With Method(1), I have to change the keyboard’s layout everytime I want to type the other language.
  3. When I used Method(1) I still have to setup VIM to type Vietnamese. Also, every time I want to jump to a letter in VIM, I have to wait for the buffer to stop receiving input before the cursor jumps to the place I want.
  4. Install a software just to type is silly to me since X11 already has the feature to type all char of UTF-8.
  5. I like to do my own typing because with Method(1) I dare you type this: địảởâu¿
  6. All the special char are right below my fingers i.e: £2⁸÷⅜₿×₫6⁵−8°+∞≠Ø35mm𝅘𝅥♪♫…😜
  7. Setting up the keyboard for X11 is more flexible, light and faster.
  8. I don’t mind learning.

We all had to learn how to use the pen in early years of life. We learned to wield the pen first I think not because we were too young to press a button on the keyboard. The reason I think is because understanding the concept of written words is a must before finding tools to improve on speed. So it is better I share what I know so you have a better perspective when pressing a button on your electronic keyboard…

Caution: Use only ONE out of the two methods if you want to stay sane.




updated: 2022-06-09
(change name)


Background Knowledge


updated: 2023-02-12
(load picture local)

You are reading this on an electronic device. I am also writting this on a computer. Written word is the oldest tool that man(andwomanforthesexistpeopleoutthere) have invented to communicate over the barrier of time. The printing press lifted the restriction of space in around 1440. Digital tech rocketed the speed from source to the fruit to the max since the year 1960.

Hansen’s ball of words¹

Before typewriters were common for people at around 1860, the only tools to write were paper, pen and ink. Personal computer were only really common since 1990s. The virtual keyboard on touch screen devices were only around since 2010. And in this era, most keyboards has the format of ‘QWERTY’.

This arrangement of the English alphabet in this ‘QWERTY’ formation started from the machine by Sholes & Gilden debut in 1874. The rest of the characters on the keyboard that are printable belong in the ‘American Standard Code for Information Interchange’ short to ASCII.

We are used to this American keyboard because it is the most popular and widely distributed on the market not just in Việt Nam but also all over the world. No one knows for sure but my guess is that because software of this digital age are mostly written base on ASCII.

The GNU/Linux operating system uses X11 as the graphic server. This protocol is not only popular on Linux but also other *NIX*. The ‘11’ in the ‘X11’ refers to the eleventh version that this software was published since September 1987.

X11 is a protocol to serve graphic. Meaning it only provides the mechanism for other software to draw on the LED screen, and pass over the signals from the keyboard and the mouse. Another word, X11 is a bridge:

[input devices] →X11→ [application] →X11→ [output devices]


Hansen Ball Of Words¹:,1867,_D%C3%A4nemark.jpg



updated: 2022-08-02
(spelling mistakes)

When you fire up a graphical software that receives input from the keyboard like a terminal emulator and press a button on the keyboard’s hardware, the signal will travel from the hardware to the Linux’s kernel and then pass to X11 to transcode according to your symbols configuration. This piece of code will then be sent to the software that need to display the character on screen like the terminal emulator that you have opened in front of you.

We will use showkey to see how this mechanism work for the keyboard in Linux.

Every button on the hardware sends a unique signal for itself. If you are curious to see what the Linux kernel sees from the button you press, run this command:

    sudo showkey --scancodes    

The program will quit after 10 seconds of not pressing anything.

The number you see on the screen is base 16. This number represents the signal from the actual hardware of the keyboard.

Unless you are a low level engineer most people don’t want to look at these bizzard numbers so Linux change it to keycode - the code for the key pressed. You can see what Linux change this signal to with this:

    sudo showkey --keycodes    

Wait for 10 sec to quit.

This is what X11 gets from the Linux’s kernel.




updated: 2022-06-09
(spelling mistakes)

To type any capital letters, we combine the [Shift] with the normal char that we want to capitalise. This change the signal right from the hardware and thus the software we use will get a different set of codes and hence show a capital letter.

Like the [Shift], other buttons like [Esc], [Pause/Break], [ScrollLock], [Window], [Ctrl], [Alt],… work the same way.

To see what the software return, run showkey again with --ascii option or short -a.

    sudo showkey --ascii    

Quit with [Ctrl]+[d].

With the command above, you can see that the button that you pressed really send the signal to the software according to the set of char in ASCII. For example, the letter ‘T’ sent the code of ‘84’.

The most popular keyboard’s hardware are all produced based on ASCII and can only type English - not Vietnamese or Latin….

And so the solution to write characters other than English is to translate the code from ASCII to different standard like Unicodes. More precisely is UTF-8 - the table of char that includes all the characters that human would ever use.

This is really the main job of X11 in regards to the keyboard.

The application we are using here is showkey -a so it returns printable character. But with the concept above, I hope you realise that you can configure X11 to send whatever code you want from the button that you pressed on the hardware. Meaning even if you bought a ‘QWERTY’, you can change it to ‘AZERTY’ or absolutely anything that you wish if you use Linux and X11.

You can run this showkey program again to verify after installation and explore some more.

Levels of Char

If we say that normal letters are level 1 then capital letters would be level 2.

X11 doesn’t just have 2 levels but 5+1 levels. I don’t even use all the 4 levels but you can customise your keyboard according to whatever your needs are after installing the new char set.

    │ 2 4 │   2 = Shift,  4 = Level3 + Shift    
    │ 1 3 │   1 = Normal, 3 = Level3 (AltGr)

By default, the [Alt] on the right is used to get to the third level like the [Shift] button to the second level. This button has a special name called [AltGr] - short for “Alternative Group”. Level 4 is the combination of both the [Shift] and [AltGrp] at the same time.

Level 5 will have to found by yourself.

X11 has another level called “Compose”. The amount of characters that can be type with this many levels can keep you busy for years and years.

Dead Keys

Vietnamese Alphabet is based on Latin. The picture below is not the current alphabet table but it has all the characters for both English and Vietnamese - perfectly fit the problem of someone who is trying to type both languages on a same keyboard.

Vietnamese (old) Alphabet (1984-03-05)

To type Latin accent characters (not just Vietnamese), they thought of virtualise the dead key in the software of X11 similar to the dead keys found on typewritters. This name came about since the piece of paper doesn’t move on the machine when the handle strike.

Below are all the chars|accent|dead keys that are used in Vietnamese:

Other dead keys (that are in my design):

To type a Vietnamese char using these dead key, you need to press the dead key before the base char.

For example, to type ‘ý’ press [AltGrp]+[s] first then press [y].

Similarly, to type ‘ấ’ press [AltGrp]+[s] first then press [AltGrp]+[a].


I designed on the ‘QWERTY’ (hardware) format with the goal of keeping all the ASCII char (used for programming); but must open up the ability to type both English, and Vietnamese document without the need to change the configuration (in software) through out process of the typing.

For Vietnamese, I think the third level is very logical to strike the deadkey so they are all on this level.

Because I can put them anywhere on the keyboard, other than placing them in the usual spot to type Telex , I also place them on the right of the board so I can now use both hands to do to the same job. Below is a figure for all 4 levels.




updated: 2022-12-26

I will install on Debian in this guide. If you use other distro then use equivallent tools. The account you use to install also need to be able to run sudo.

First to avoid clashing between two method of typing Vietnamese, we should make sure that the system doesn’t run ibus-unikey. Best to remove the thing entirely:

    sudo apt purge ibus* im-config    

Now reboot just to be safe.

My keyboard design is in here.

You can download this file by running the command below if you already have wget. If not then run sudo apt install wget first.

    wget -O /nơi/bạn/lưu/    

Caution: /nơi/bạn/lưu/ is your choice so don’t just copy and paste the command above.

When you log in to the computer, X11 will load character set from this directory:


You can run ls to see what’s in there.

We are going to use vn in the directory above so make sure you save the original in case of trouble:

    sudo cp /usr/share/X11/xkb/symbols/vn /usr/share/X11/xkb/symbols/vn.orig    

Then move the new file into there:

    sudo mv /nơi/bạn/lưu/ /usr/share/X11/xkb/symbols/vn    

Now we need to configure X11 to load our new character set. Again, backup this file just in case.

    sudo cp /etc/default/keyboard /etc/default/keyboard.orig    

I use VIM and you should also learn how to use VIM:

    sudo vim /etc/default/keyboard    

Change the content of this file as follow:


With the content on the XKBLAYOUT line, X11 will read this file:


I use the standard keyboard with 104 buttons so on the XKBMODEL I put "pc104". If you use something else the then change this according to your hardware.

The line XKBOPTIONS I configure to swap the [Caps Lock] and the [Escape] button to use easilly with VIM. You can change this to your liking. (Check the upgrade section below.)

Finnally, you just need to log out of X11 and then log back in to type Vietnamese.




updated: 2022-06-13
(fix links)

When using Linux or other *NIX* base OS, you can always upgrade yourself by reading the manual right from your machine. First is X11:

    man X    

You should check out how to configure /etc/default/keyboard:

    man keyboard    

Debian also have a tutorial that is very easy to understand:

Like mentioned above, you have lots of choices to configure your keyboard. Run this command to see all of the choices for X11’s keyboard:

    man xkeyboard-config    

You can check out other UTF-8 characters to tune your character set to suit your need from this file:


Also this page:

Caution: the app and|or the font you use will determine how the UFT-8 character will be displayed.

My design approach was influenced by Marcin Woliński who designed the keyboard for Polish.

Picture and the base|original keyboard I used was from this file:


Most of all, I amd standing on the shoulder of Nguyễn Văn Vĩnh who was thought to had designed this typing style of Quốc Ngữ Điện Tín or more commonly known as Telex.