I’ve always struggled to configure my English keyboard to use Spanish characters like á
, é
, í
, ó
, ú
, ñ
.
I opted to use English keyboard layout instead of my native Spanish layout because it’s faster to write programming
characters {}, [], ()
using Shift instead of Alt GR.
Before the compose key, I needed to change the keyboard layout to Spanish and use a combination of characters to get the character I mentioned.
I’ve finally dedicated some time to figuring it out, and it was quite easy to configure and use these characters!
Configuring compose key
Here’s my setup:
- Keyboard: Atreus
- OS: Arch Linux
- Display Server: Wayland
- Compositor: Sway
Depending on your OS/Display Server, you would need to look up your configuration. Let me know if I can help in the comments :).
I’ve set up the right control as the compose key given that my keyboard has limited keys (atreus). I’ve configured my
layout “#1” ctrl
key to be right ctrl
using chrysalis (UI to configure my
keyboard).
Command to get the available compose keys:
grep "compose:" /usr/share/X11/xkb/rules/base.lst
Test your compose key and combinations with this command for the current sway session:
swaymsg 'input * xkb_options compose:rctrl'
Now that you’ve chosen your compose key, use Sway config to set the compose key on startup:
input type:keyboard xkb_options "compose:rctrl"
Using the compose key
Depending on the character you want, you’ll use different compose sequences. Here are the most common ones.
Sequence | For | Sequence | For | |
---|---|---|---|---|
Compose ’a | á | Compose oo | ° | |
Compose ”a | ä | Compose ox | ¤ | |
Compose `a | à | Compose oc | © | |
Compose ~a | ã | Compose or | ® | |
Compose ^a | â | Compose so | § | |
Compose ca | ǎ | Compose ss | ß | |
Compose oa | å | Compose SS | ẞ | |
Compose -a | ā | Compose th | þ | |
Compose ,a | ą | Compose TH | Þ | |
Compose ba | ă | Compose tm | ™ | |
Compose ?a | ả | Compose ?? | ¿ | |
Compose .a | ȧ | Compose ’< | ‘ | |
Compose ~n | ñ | Compose ’> | ’ | |
Compose <s | š | Compose ,c | ç | |
Compose |c | ¢ | Compose ,C | Ç | |
Compose =y | ¥ | Compose 12 | ½ | |
Compose =c | € | Compose 14 | ¼ |
Useful links
That’s it! Enjoy using your en_US layout while you also write Spanish, Portuguese, or other languages that make use of acute accents.