DEV Community

Cover image for Accents on Dvorak with AutoHotkey
Camilo Martinez
Camilo Martinez

Posted on • Updated on

Accents on Dvorak with AutoHotkey

Maybe you may know that there is no available International distribution for the Dvorak keyboard. At most, you will find the US distribution.

But if you are like me, that need accents because of my native language (Spanish) is there a way to add it with an AutoHotKey script.

I will detail the process for Spanish accents and you can use it as an example in case you need to create your own.


Steps

  • First, you need to recognize the accents áéíóú, letters and ñ and symbols ¡¿ that you want to remap and search his correspondent decimal value on the ASCII table.
Char Dec Char Dec
á 0225 Á 0193
é 0233 É 0201
í 0237 Í 0205
ó 0243 Ó 0211
ú 0250 Ú 0218
ñ 0241 Ñ 0209
¿ 0191 ? 63
¡ 0161 ! 33
  • Next, we need to remap each key with desired destinations following this format OriginKey::DestinationKey taken attention of his modifiers keys.
Char Modifier
^ Ctrl
! Alt
+ Shift
  • Create a script file called accent-keys.ahk adding the remap configuration.
!a::Send {Asc 0225} ; Alt+a -> á
!+a::Send {Asc 0193} ; Shift+Alt+a -> Á
!d::Send {Asc 0233} ; Alt+e -> é
!+d::Send {Asc 0201} ; Shift+Alt+e -> É
!g::Send {Asc 0237} ; Alt+i -> í
!+g::Send {Asc 0205} ; Shift+Alt+i -> Í
!s::Send {Asc 0243} ; Alt+o -> ó
!+s::Send {Asc 0211} ; Shift+Alt+o -> Ó
!f::Send {Asc 0250}  Alt+u -> ú
!+f::Send {Asc 0218} ; Shift+Alt+u -> Ú
!l::Send {Asc 0241} ; Alt+n -> ñ
!+l::Send {Asc 0209} ;  Shift+Alt+n -> Ñ
Enter fullscreen mode Exit fullscreen mode

In Spanish, the exclamation and question mark symbols need to be open at the beginning and close at the end.

!+[::Send {Asc 0191}{Asc 63}{left 1} ; Shift+Alt+[ -> ¿?
!+1::Send {Asc 0161}{Asc 33}{left 1} ; Shift+Alt+1 -> ¡!
Enter fullscreen mode Exit fullscreen mode

The last two have another trick. It will create open and close symbols and with the {left 1} command move the cursor between them.

And if you work on Javascript, like me, it will be useful to create some shortcuts for logical comparison.

Char Dec Char Dec
= 61 < 60
! 33 > 62
!+::Send {Asc 61}{Asc 61}{Asc 61} ; Alt+= -> ===
!++::Send {Asc 33}{Asc 61}{Asc 61} ; Shift+Alt -> !==
!,::Send {Asc 60}{Asc 61} ; Alt+, -> <=
!.::Send {Asc 60}{Asc 62} ; Alt+. -> >=
Enter fullscreen mode Exit fullscreen mode
  • Finally, Save the file and open it with AutoHotkey.

Dvorak Keyboard with Accents

dvorak-accents

Avoid override

We recently defined the shortcut Alt+Shif+A, but for example, VSCode also uses this same shortcut to toggle comments.

we can simulate the (AltGr) as a modifier changing all the Alt+Shift+ maps to only works with RightAlt+Shift+. Just change !+ modifiers with >!+.

Now you can still use the LeftAlt+Shift+a on VScode and RightAlt+Shift+a to write the Á (with accent). It's up to you if you like to convert all Alt modifiers to AltGr (Leftright) or only the combinations with conflicts.


That’s All Folks!
Happy Coding 🖖

beer

Top comments (0)