Kinto — Type on Windows like it’s a Mac

Ben Reaves
5 min readApr 5, 2020

--

The Zero Effort Solution Part II

kinto.sh Now Supports Windows

Anyone that has been following me, or the development of Kinto, may be aware of it being a robust remapping solution for professional mac users and developers, but what about Windows?

Surprisingly I have not gotten too many requests for Windows support, however — the reality of the world and workplace pretty well dictates that most of us devs and professionals will have to use Windows in some capacity or another. And much like with linux, this was not my first foray into remapping Windows to use Mac like keybinds.

Windows 10 and WSL has certainly changed the game a good bit, and with one of their updates awhile back they brought Ctrl+Shift+C/V into the mainstream — for Windows anyways. A wonderful edition given the conflicting nature of having the keymap layout Windows and Linux both share. It also gave me something to work with that wasn’t a 3rd party app or download, but an actual 1st class citizen on the platform.

Microsoft is also working on a new set of exciting Powertoys for Windows 10, one called Keyboard Manager, and had it been further along when I decided to make this I might have just created a profile that makes use of it. Would it be as powerful and useful as Autohotkey though? Who knows for sure until they release it.

So how did I go about remapping Windows to use Mac like keybinds in the past? I used Sharpkeys and Autohotkey and kept it very simple, but it also meant I did not have some key shortcuts in some apps like Sublime Text, without modifying its config files (which I no longer wish to do with any app).

Key Differences

Under Linux xkb is very flexible and you can literally change any aspect of your keyboard in real time. This is not so under Windows, any changes to the scan codes, the keys themselves requires a log out and log back in of the user. Short of that you will have to write a program to hook into user32.dll and modify the keycodes in memory I suppose. While I would like to do that even more I decided to not spend the time doing something like, especially when considering that Microsoft will be releasing a tool fairly soon that may address this perfectly fine — but it really does not impact the Kinto Windows solution at the end of the day.

Kinto first remaps the keys in the registry and expects the user to log off and back on. When they log back on they will also find that the autohotkey script called kinto.ahk has been executed from their Startup path folder.

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Another thing they will find is that wordwise hotkeys that macs use have been added, proper in app tab switching on Ctrl and normal app switching is on Cmd. Of course keymap changes that should occur on terminals are set to occur, so Cmd+C and Ctrl+C do as you’d expect it to.

This file may change with more shortcuts but if you want to see a peek of kinto.ahk for windows here it is. Unlike many of autohotkey solutions this is a minimal approach — the biggest keyswap happened via the registry already so that autohotkey only has to address the odd ends here and there in much the same way that Kinto for Linux does it as well.

GroupAdd, terminals, ahk_exe ubuntu.exeGroupAdd, editors, ahk_exe sublime_text.exe; Cmd Tab For App Switching
LCtrl & Tab::AltTab
RCtrl & Tab::AltTab
; Ctrl Tab for In-App Tab Switching
LWin & Tab::Send ^{Tab}
RWin & Tab::Send ^{Tab}
; Close Apps
^q::Send !{F4}
; wordwise support
$^Left::Send {Home}
$^+Left::Send +{Home}
$^Right::Send {End}
$^+Right::Send +{End}
^Up::Send ^{Home}
^+Up::Send ^+{Home}
^Down::Send ^{End}
^+Down::Send ^+{End}
^Backspace::Send +{Home}{Delete}
!Backspace::Send ^{Backspace}
!Left::Send ^{Left}
!+Left::Send ^+{Left}
!Right::Send ^{Right}
!+Right::Send ^+{Right}
#IfWinActive ahk_group editors
; Remap Ctrl+Shift to behave like macOS Sublimetext
; Will extend cursor to multiple lines
#+Up::send {shift up}^!{Up}
#+Down::send {shift up}^!{Down}
; Remap Ctrl+Cmd+G to select all matches
#^g::send !{F3}
#If
#IfWinActive ahk_group terminals
^c::Send {LCtrl down}{LShift down}c{LCtrl Up}{LShift Up}
#c::Send {LCtrl down}c{LCtrl Up}
#x::Send {LCtrl down}x{LCtrl Up}
#o::Send {LCtrl down}o{LCtrl Up}
#r::Send {LCtrl down}r{LCtrl Up}
#w::Send {LCtrl down}w{LCtrl Up}
#\::Send {LCtrl down}\{LCtrl Up}
#k::Send {LCtrl down}k{LCtrl Up}
#u::Send {LCtrl down}u{LCtrl Up}
#j::Send {LCtrl down}j{LCtrl Up}
#t::Send {LCtrl down}t{LCtrl Up}
#_::Send {LCtrl down}_{LCtrl Up}
^v::Send {LCtrl down}{LShift down}v{LCtrl Up}{LShift Up}
#If
#IfWinActive ahk_exe powershell.exe
^c::Send {LCtrl down}{LShift down}c{LCtrl Up}{LShift Up}
#c::Send {LCtrl down}c{LCtrl Up}
#If
Ubuntu Theme Applied to WSL 1

Another thing I have included with Kinto for Windows are the registry entries that help give all consoles in Windows a more readable color theme, which is lifted from an itermcolor profile over at this repo. I would not have included this had it not been for the impossible to read blue text on black.

I also don’t believe any Windows user should have to install the Microsoft ColorTool just to install a usable theme so I created a few registry files for different themes. Also, like in classic Microsoft fashion, the latest ColorTool is broken so make sure you use the one from October 2018.

Overall, I am extremely pleased with this solution and how well it works and how quickly I was about to put it all together in just a few hours. It also makes me realize how much more clear and concise I could potentially make Kinto for Linux appear as well.

Thoughts on Revisiting the Linux Implementation

I may revisit some of the things I have done on the Linux side of things with xkb and see if I can’t use a combination of udev/hwdb and xkeysnail as I feel like xkeysnail is much more of a successor to autohotkey on linux than what autokey, xte, or xdotool are and could actually deliver something that a wider audience of users would be able to make use of (modify) without the limitations or issues I’ve had with autokey and others in the past.

XKB is very powerful, but it is also much more complicated. I like that it does not intercept keypresses though and simply sets them all as they should be from the moment the app name changes, but it still isn’t very user friendly. If nothing else I could offer 2 methods of handling keymaps for users and their apps so if they want to make keymap changes they don’t have to sort through the mess that is xkb or put in a feature request for something that they feel should be simpler. I am also considering creating a GUI interface to help with the creation of xkb keymaps.

I think that pretty well covers this latest addition to Kinto. Please visit kinto.sh and try it out and let me know what you think. I am always looking to improve this tool for myself and others so please don’t hesitate to let me know how it is working for you.

--

--