rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.52k stars 217 forks source link

Kinto.sh

kinto-color-132

GitHub release

- Mac-style shortcut keys for Linux & Windows. -

Seamless copy and paste with all apps and terminals. The zero effort solution.

v1.2 Release - Kinto now includes a system tray and simple wizard to setup the install with minimal effort.

Kinto is powered by xkeysnail for Linux & by Autohotkey for Windows 10 & 11.

Note: VNC is now experimentally supported on Linux w/ the latest releases, but you must compile & install x11vnc. More info can be found here.

Note: If you plan to remote into Linux via VNC, xRDP, Synergy or other remote desktop solutions then remove the current release & try an earlier v1.0.7-3 release. It uses xkb so it'll work with virtual xinput devices. Some v1.1-x releases may offer both, but all v1.2.x releases ended support for xkb. I do plan to bring offical support back for virtual input devices.

Table of Contents

Donations

If you like or appreciate this project then please consider donating.

Wishlists Amazon Adafruit eBay

I have received some really great letters with donations & email. I've also posted some of them with redacted first names to kinto.sh.

Also if you would like to send me a keyboard directly then please reach out to me over twitter and send me a DM.

How to install (Linux)

Video Tutorial: Install Kinto.sh for Linux in less than a minute

Linux Requirements

Quick Install Method

Paste the following into your Terminal

/bin/bash -c "$(wget -qO- https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh || curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh)"

Uninstall

/bin/bash <( wget -qO- https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh || curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh ) -r

Old Install Method

git clone https://github.com/rbreaves/kinto.git
cd kinto
sudo apt update
sudo apt install python3
./setup.py

Troubleshoot

If the wizard does not appear then either type in "kinto.sh" in your application overview search bar or run this following command.

~/.config/kinto/gui/kinto-gui.py

Issues with Numpad?

Try toggling numlock on & off (clear key on official mac keyboards). If it still does not work then restart the Kinto service and try toggling the numlock/clear key again, it will likely work after that. #369

Uninstall Kinto

./setup.py -r

Other tips

If you want a global menu app similar to what mac users have then I strongly recommend Ubuntu Budgie as it has the Vala Appmenu built in and ready for activation. Short of that Vala-AppMenu can be installed in various distros, mileage will vary. If you try to activate it in the latest 20.xx releases with XFCE then you may need to run the following commands.

sudo apt install xfce4-appmenu-plugin vala-panel-appmenu-common appmenu-gtk2-module appmenu-gtk3-module appmenu-gtk-module-common
xfconf-query -c xsettings -p /Gtk/Modules -n -t string -s "appmenu-gtk-module"

Fractional HiDPI Scaling for Gnome/Budgie w/ x11

https://github.com/rbreaves/betterScale

Use this with autorandr to save your settings as a profile that will auto re-apply when needed.

How to Install (Windows)

Video Tutorial: How to Install Kinto.sh on Windows 10

Windows 10 Requirements

Quick install

Open Powershell as Administrator and copy and paste the following. This will download & extract Kinto, install chocolatey, python3 and then install Kinto.

⚠ NOTE: Please inspect https://raw.githubusercontent.com/rbreaves/kinto/master/install/windows.ps1 and https://chocolatey.org/install.ps1 before running scripts directly. More information about running powershell scripts in this context can be found here.

Set-ExecutionPolicy Bypass -Scope Process -Force
iwr https://raw.githubusercontent.com/rbreaves/kinto/master/install/windows.ps1 -UseBasicParsing | iex

Update system tray to show Kinto icon at all times (optional)

cmd /c "explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}"

Old method

  1. Open Powershell (Right click and Run as Administrator)

  2. clone this repo

    git clone https://github.com/rbreaves/kinto.git
    cd kinto
  3. Install - Select keyboard type

    py setup.py
  4. How to make Kinto stay visible in system tray (optional)

Uninstall Kinto

py setup.py

Select Uninstall

How to use in Remote Desktop Solutions

RDP fully works as long as the entire keyboard input is being captured. RDP had been working for awhile with Windows but as of 2/14/2021 Linux & macOS is now supported. VNC & other protocols may work, but is likely most dependent on how the keyboard input is captured on the computer running the client.

Program Src/Remote Client ⇒ Dst/Remote Server Works? Notes
Official MS RDP (mstsc.exe) ❖Windows ⇒ ❖Windows ✅ Yes Note: Make sure to set all keyboard input to go to remote.
Official MS RDP (mstsc.exe) ❖Windows ⇒ 🍎macOS ✅ Yes Note: Must compile & install xrdp.
Official MS RDC from Store ❖Windows ⇒ ❖Windows ✅ Yes Note: Only when maximized, all modifier keys will not pass in otherwise.
Official MS RDC from Store ❖Windows ⇒ 🍎macOS ✅ Yes Note: Must compile & install xrdp.
RealVNC ❖Windows ⇒ 🐧Linux ✅ Yes Note: Compile & install my forked x11vnc for compatibility.
Official MS RDP (mstsc.exe) ❖Windows ⇒ 🐧Linux ✅ Yes Note: Compile & install my forked x11vnc for compatibility, then setup xrdp like normal & use xrdp 0.9.18+.
Official MS RDC from Store ❖Windows ⇒ 🐧Linux ✅ Yes Note: Compile & install my forked x11vnc for compatibility, then setup xrdp like normal & use xrdp 0.9.18+.
Official MS RDP ChromeOS 87+⇒ ❖Windows ✅ Yes May work on earlier versions as well, if they support Android apps
Remmina 🐧Linux*/ChromeOS 87+⇒ ❖Windows ✅ Yes *Use hover menu to enable "Grab all keyboard events"
FreeRDP 🐧Linux/ChromeOS 87+⇒ ❖Windows ✅ Yes
FreeRDP 🍎macOS⇒ ❖Windows ✅ Yes FreeRDP for macOS
Remote Desktop Manager Free 🍎iOS⇒ ❖Windows ✅ Yes
Jump Desktop (RDP) 🍎macOS*/iOS ⇒ ❖Windows ✅ Yes *Preferences -> Keyboard -> Disable "Key Conversions", Enabled "Send macOS Shortcuts" under Keyboard shortcuts
Jump Desktop (VNC) 🍎macOS⇒ 🐧Linux ✅ Yes Note: Compile & install my forked x11vnc for compatibility & use xrdp 0.9.18+.
RealVNC 🍎macOS⇒ 🐧Linux ✅ Yes Note: Compile & install my forked x11vnc for compatibility.
Official MS RDP 🍎macOS⇒ ❖Windows ❌ No Initial Cmd key press not being passed
Remote Desktop Manager Free 🍎macOS⇒ ❖Windows ❌ No Initial Cmd key press not being passed
Royal TSX Client 🍎macOS⇒ ❖Windows ❌ No Initial Cmd key press not being passed
Official MS RDP 🍎🤖iOS/Android⇒ ❖Windows ❌ No No workaround atm

How to Remap Windows keyboards for remote access to macOS

Quick summary - Swap Alt & Win to conform with Apple keyboard layouts. Sharpkeys for Windows, Setkeycodes for Linux, then install Kinto.sh or change/update the Keyboard Type to Apple in the system tray. https://benreaves.medium.com/macos-to-linux-back-again-c6151200f4dc

FreeRDP for macOS

  1. Install brew.sh.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Install XQuartz (x11/xorg)

brew install --cask xquartz

  1. log off and back on.
  2. Install FreeRDP

brew install freerdp

  1. Disable NLA, if it is enabled on the destination.
  2. Run command to access machine Note: 192.168.x.x = Your IP.

xfreerdp /u:your_username /v:192.168.x.x /cert-ignore /auto-reconnect-max-retries:0 /f +clipboard -decorations

  1. Click on XQuartz -> Preferences and set these checkmarks so that fullscreen can work, may need to quit it and re-run the xfreerdp command from step 6.

More info here https://medium.com/idomongodb/macos-rdp-to-a-windows-machine-1e0f52f777b

Jump Desktop for macOS

Screenshots of how to configure Jump Desktop for macOS users accessing a Windows PC with Kinto installed. I apologize that it is not a free RDP client - BUT it does work, and at $15 it is reasonable if you plan to use it frequently.

Table of Contents

How to install (Linux)

How to install (Windows)

What does this do exactly?

What's different from other remappers?

What does Kinto require?

Shortcut Creation

How to Upgrade/Control Kinto

Troubleshooting

Language Support

Related or Useful Resources

Contributing

More information about Kinto

License

Credits and Contributions

What does this do exactly?

Kinto works for standard Windows, Apple and Chromebook keyboards. The following however describes the dynamic rebinding based on a standard Windows/Mac keyboard.

GUI Physical Ctrl Win/Alt Alt/Cmd Spacebar
Virtual Win/Super* Alt RCtrl Spacebar

*Win/Super will properly remap to LCtrl when needed to fully support expected keymaps.

Terminal Physical Ctrl Win/Alt Alt/Cmd Spacebar
Virtual LCtrl Alt RCtrl Spacebar

Note: RCtrl for terminals is also adding in Shift most of the time, however it depends on the specific terminal in use and will change itself to the expected keymaps of that terminal application.

What's different?

Compared to most other remappers this is a complete system-wide remap of your base level modifier keys, this saves time. You're not going to die a death of a thousand papercuts from trying to support every shortcut key under the sun.

It also retains some of the most commonly used system level shortcut keys, such as Cmd-C/V, Cmd-Tab, and Ctrl-Tab among others. You will keep seamless copy & paste between all apps, ability to switch Windows while still using the physical Cmd/Alt key position; switch tabs in your favorite terminals, code editors, or web browsers. Depending on your OS and/or Desktop Environment you may also be able to switch Virtual Desktop environments the same way as well and other basic system level shortcuts.

If your OS and macOS have similar functionality on the system level, but only differ by a slight difference of a shortcut command then Kinto likely supports it already. If Kinto doesn't have what you need then you can open up a support ticket and it will be added. You can also fork the project to add the fix and I will merge it via a PR you make.

Additionally, if you are using a cross-platform app and if it happens to have a few shortcut keys that differ then that can very easily be added to either the kinto.py or kinto.ahk configuration files which on Windows is located here ~/.kinto/kinto.ahk and on Linux it can be found here ~/.config/kinto/kinto.py. More info can be found here Shortcut Creation

What does Kinto require?

Kinto for Windows 10 Requirements

Other programs that will be installed when you run ./setup.py

Note: Sublime Text users should disable screen rotation hotkeys as they will interfere with multi-cursor and possibly other combos. See https://windowsloop.com/disable-screen-rotation-keyboard-shortcut/ for details.

You may also want to disable the Xbox Game Bar so that Win+G or other shortcuts will not interfere with any of your remaps. Start menu -> Game bar shortcuts -> toggle Off.

Shortcut Creation

Linux Shortcut Creation (Xkeysnail)

Windows Shortcut Creation (Autohotkey)

Linux (Xkeysnail)

GUI Keys Value Description Mac/Kinto Equivalent
C,Ctrl Control Cmd
M,Alt Alt/Option Alt/Option
Super Win/Super Ctrl
Terminal Keys Value Description Mac/Kinto Equivalent
RC,RCtrl Right Control → Left & Right Alt/Cmd key Cmd
M,Alt Alt/Option Alt/Option
LC,LCtrl Left Control Ctrl

You can define new keymaps for your specific app via this method. You also do not have to cancel out the original keybinding if you do not need or want to, but you can do so with "pass_through_key".

Defining Keymaps Per App

# Keybindings for Sublime Text
define_keymap(re.compile("Sublime_text"),{
    K("C-h"): pass_through_key,          # cancel replace
    K("Ctrl-Alt-f"): K("Ctrl-h"),        # replace
    K("C-M-v"): [K("C-k"), K("C-v")],    # paste_from_history
}

In the above example I am also showing that you can define a single shortcut to enact multiple shortcut keys if needed by defining an array of shortcuts to trigger.

To make changes you can edit ~/.config/kinto/kinto.py under linux & restart the xkeysnail service via the system tray, app or CLI.

systemd

sudo systemctl restart xkeysnail

sysvinit

sudo -E /etc/init.d/kinto restart

More information can be seen on the readme page of xkeysnail.

Windows (Autohotkey)

This applies to the Windows version of Kinto and how to add additional support for Applications. The configuration file location is ~/.kinto/kinto.ahk and after updating it you will want to right click on the tray icon and click on setting your keyboard type again and it will re-apply the latest changes.

Windows 10 has a couple of ways that you need to be aware of when trying to add a specific application, the typical method of how to add any exe program, but then there is also the newer UWP app format that some applications use which will require a similar but different method, both will be discussed.

Defining Keymaps Per App by EXE Name

You can use the following legend but realize that these remaps reference the Virtual keys in the diagrams mentioned near the beginning of this document, so do not confuse it with the physical key unless they happen to be the same key.

Autohotkey Symbol Virtual key Description
^,Ctrl Control Primary modifier, 1st rock from the spacebar
!,Alt Alt Secondary modifier, 2nd rock from the spacebar
#,Win Win/Super Tertiary modifier, 3rd rock from the spacebar
...
#IfWinActive ahk_exe sublime_text.exe
    #^Up::send !{O}                                         ; Switch file
    #^f::send {F11}                                         ; toggle_full_screen
    ^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up}    ; paste_from_history
    ...
#If
...

With this being Autohotkey you can easily pull knowledge from the Autohotkey forums for just about any issue you may have as well.

Defining Keymaps Per UWP App

#If WinActive("- OneNote ahk_class ApplicationFrameWindow", "OneNote")
...
    ; Add your keymaps here
...
#If

I don't have too many examples on this one, most developers seem to be shying away from UWP. Kinto currently supports "Fluent Terminal" which is a UWP app, but it is also being grouped with other Terminal apps for hotkey remapping. You may take a look at that, but you may also want to try creating a new Autohotkey file and use the Window Spy feature built into Autohotkey to help you discover the full name and class names of any application.

Shortcut Creation (XKB)

The older xkb shortcut method info can be read about in ticket #125.

How to Upgrade Kinto

Simply bring down the latest then you can re-run the setup.py installer, it will stop the service and re-install Kinto.

Note: If you have made any custom changes to ~/.config/kinto then you will need to backup or rename those directories before running an update.

git pull origin master
./setup.py

How to Control Kinto

This info is now superceded by the fact that linux has a full fledge GUI and system tray app that is very easy to use, but I will keep the command line options for those that want to know what they are.

Status

systemd

sudo systemctl status xkeysnail

sysvinit

tail -f /tmp/kinto.log

Stop (your keymap will return to normal)

systemd

sudo systemctl stop xkeysnail

sysvinit

sudo -E /etc/init.d/kinto stop

Start

systemd

sudo systemctl start xkeysnail

sysvinit

sudo -E /etc/init.d/kinto start

Restart

systemd

sudo systemctl restart xkeysnail

sysvinit

sudo -E /etc/init.d/kinto restart

Troubleshooting

Installed successfully, but modifier keys are not properly remapped?

Are you using a VM on macOS? If so you may need to disable automatic remapping of the Cmd key when using Vmware Fusion of Parallels.

Disable Parallels Re-mapping: 1) Open Parallels and go to Preferences. 2) Click Keyboard and disable the Virtual machine shortcuts. 3) Close Preferences.

To disable keyboard mapping: 1) From Fusion's menu bar, click VMware Fusion > Preferences... 2) Click Keyboard & Mouse. 3) Click the Key Mappings tab. 4) Deselect Enable Key Mapping.

Does not start when you log in or after you reboot?

You may need to manually set your DISPLAY in the systemd service file. Normally it pulls in the proper DISPLAY value but if it doesn't you can try this.

Another possibility is the SELinux could be enabled and needs to be set to permissive. (aka /etc/selinux/config)

To reset the display variable

echo $DISPLAY

# :0.0

You can use the Kinto.sh app or system tray to edit your service file.

kinto.sh gui

  1. Edit -> Edit Service kinto tray
  2. Customize -> Edit Service

or you can use your terminal.

sudo nano /etc/systemd/system/xkeysnail.service

...
[Service]
Type=simple
Restart=always
Environment=DISPLAY=:0.0
...

If you continue to have issues then open a ticket and send me the info.

Language Support

I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages.

Related or Useful Resources

Xkeysnail by mooz

Yet another keyboard remapping tool for X environment

libinput-gestures Three finger gesture or other type of gestures for desktop switching or other features within a Linux distro. More info here for quickly setting it up. Make sure you logoff after setting your user to access input. https://www.reddit.com/r/GalliumOS/comments/5lgrxe/psa_multitouch_gestures_on_galliumos/

Interception

Another low level key remapper, not as easily configurable as Xkeysnail, but does not rely on X11.

Wincent by Greg Hurrell

Dot files and configurations that may help those that want mac-style shortcut keys that work under Wayland, or w/o x11. Vim #102: macOS keyboard bindings on Linux

mac-precision-touchpad by imbushuo

Windows 10 touchpad to precision touchpad driver

macOS-cursors-for-Windows by antiden

macOS cursors for Windows

QuickLook for Windows by QL-Win

It allows users to peek into a file content in lightning speed by just pressing the Space key

fusuma by iberianpig

Multitouch gestures with libinput driver on Linux

Facetime HD Camera for Linux by patjak

Linux driver for Facetime HD on macbooks

Windows Terminal Preview by Microsoft

The best Terminal app built for Windows hands down. I have tried countless, but this one actually seems to get everything right, despite the lack of a GUI to configure all aspects of the program. Custom configurations have to be done via a json file - but given the performance and feature set I feel like it is a decent trade off.

I will update Kinto to have custom configurations for this specific Terminal in the future. Will make seamless copy & paste, which already works, work even better (Cmd-C can still trigger sigint - but there is a fix for that that involves updating the json config).

PowerToys - Windows only by microsoft

Windows system utilities to maximize productivity

AutoHotKey - Windows only by AutoHotkey

AutoHotkey is a powerful and easy to use scripting language for desktop automation on Windows.

pykeymacs by zhanghai

Emacs style keyboard macros implemented in Python

Dynamic Wallpapers by adi1090x

Simple bash script to set a Dynamic Wallpaper according to certain conditions.

macify-linux by JonChun

Automated setup scripts to transform Linux into macOS. (Uses Kinto for key remaps)

ibus-typing-booster by mike-fabian

ibus-typing-booster is a completion input method for faster typing

twemoji color font by eosrei

Twitter Unicode 12 emoji color SVGinOT font for Linux/MacOS/Windows

iTerm2 Color Schemes by mbadolato

Over 225 terminal color schemes/themes for iTerm/iTerm2. Includes ports to Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty...

espanso by federico-terzi

Cross-platform Text Expander written in Rust

GalliumOS by GalliumOS

Docs, issues, and artwork sources for GalliumOS

eOS-X by ipproductions

Dark & Light Theme w/ OSX controls for Elementary OS

Autorandr by phillipberndt

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr

Barrier by debauchee (Note: Does not appear to work with Kinto v1.2+, may work w/ Kinto v1.1?)

Open-source KVM software

Synergy Free Binaries by amankhoza

The latest freely available Synergy binaries

Synergy Official by Symless

Latest Official Synergy

Karabiner-Elements by pqrs-org

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.

mbpfan by linux-on-mac

A simple daemon to control fan speed on all MacBook/MacBook Pros (probably all Apple computers) for Linux Kernel 3 and newer

vala-panel by rilian-la-te

Vala rewrite of SimplePanel - GitHub mirror (Global Menu for XFCE)

Contributing

I welcome any and all contributors who want to add something to this project.

You can read the configuration files and the open issue tickets such as #44 Shortcut Translation Tables, #115 Shortcut Creation (xkeysnail), and #348 Missing Shortcuts: Post them here to best understand what's currently happening and how best to contribute.

More information about Kinto

https://medium.com/@benreaves/kinto-v1-0-released-2018e6401d2e https://medium.com/@benreaves/kinto-a-mac-inspired-keyboard-mapping-for-linux-58f731817c0

License

GPL v2

Credits and Contributions

I would just like to thank a few people here directly that have helped me tremendously with completing this project and without their support, direct, indirect or otherwise I would have had difficulty completing this undertaking. I will list these things off in chronological order mostly.

First off I'd like to thank the Stackoverflow and Stackexchange community. I have probably rubbed some mods the wrong way over there, but the people from the community in general are extremely helpful and gracious and without their contributions would have made this much more difficult. The person I'd like to thank most though from over there is Glen Whitney. Without his detailed explaining of how to rebind keys in xkb this would not have come together at all, as every other remapping solution were non-starters as complexity increases. Kinto today no longer uses xkb, but Glen Whitney did provide the basis of a workable method that helped me pursue this method and think it was a worthwhile project to pursue, so for that I thank him.

Secondarily I'd like to thank Christian Eriksson*, as he provided information that kept me up at night.. literally. Even after I implemented a similar bash script to one he had suggested I knew that fully implementing a c/c++ solution was where Kinto needed to head to and his explanation was better than I remember it being now that I have gone back to read it again. He also never provided a full implementation of a c/c++ solution - he did hit on the pain points pretty well of what one would need to do and watch out for. I am not sure where I got the first example code of implementing a c based solution, but he definitely went over it well.

Kui and his gist file** was really the c based solution that I found had the fewest issues to resolve to making it a reliable solution. It didn't account for all failures very well, aka BadWindow issues, but it made for a great foundation on which Kintox11 is built. I cannot thank him enough for putting it out there for others to work with.

Lastly these four people were also very helpful to me as well. @probonopd for being one of the first people to install and use Kinto and gave me the initial feedback to include wordwise support! He also has really great articles*** posted on HackerNews & Medium about UI/UX design. Another person I'd like to thank is @owzim, his feedback allowed me to rapidly iterate and fix several bugs to support additional platforms better. The last two are members of the #ubuntu channel in IRC on freenode, tarzeau ( @alexmyczko ) and sarnold. Alex contributing a proper Makefile, so the project can be packaged properly, and sarnold help me find that IBus could resolve an issue I was having with needing to detect the caret status.

Updated 6/13/2020

I would also like to thank Jonathan Chun for his patience in helping me work through a very difficult problem related to Alt-Tab switching, which led to the current xkeysnail iteration of Kinto for Linux that far exceeds the original xkb implementation. There are also several others that have created issue tickets that have contributed greatly.

If I left anyone out then I apologize, that was not intentional. I am happy to say that this project is at a state of completion. Bug fixes will primarily be the only activity happening going forward and possibly a rewrite for Wayland at some point. Contributions as mentioned above are welcomed, and will be merged into master if they help with the goal of making typing on linux more like a mac.

*https://askubuntu.com/questions/1010276/can-i-act-on-the-event-that-a-window-opens-without-polling

**https://gist.github.com/kui/2622504

***https://medium.com/@probonopd/make-it-simple-linux-desktop-usability-part-1-5fa0fb369b42