rbreaves / kinto

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

Powertoys Remap for Windows #517

Open rbreaves opened 3 years ago

rbreaves commented 3 years ago

Port AHK remap over to Powertoys and offer 3 different install options to Windows users.

  1. Default - Combination of Powertoys and AHK. Most remaps will be in Powertoys except for the more complicated ones that it cannot support well.
  2. Powertoys only - Mostly ideal for environments where you cannot have AHK. The Remapping will likely always be incomplete short of future updates bringing it to closer parity with some features of AHK.
  3. AHK only - For users that don't want Powertoys and just have everything in one place.
jonchun commented 3 years ago

Edit: I saw you posting in some issues in the powertoys repo that showed you probably already knew all of this. leaving it here anyways.

I started work on a PowerToys-only based "kinto" for windows as I am getting occasional key sticking with AHK. I haven't done enough to warrant a separate repo yet, but I wanted to post some info/snippets here since it may be useful to you.

Loading Profiles via Code -- I found JSON files in:

C:\Users\jchun\AppData\Local\Microsoft\PowerToys\Keyboard Manager

As far as I can tell, it currently only has default.json out of the box, but I think it may be easy to switch to using a non-default json (haven't actually tried yet)


Unlike AHK, PowerToys doesn't support groups of applications and requires you to add custom keybinds for each individual application as follows: image

I think the only way around this would be to generate the PowerToys config files via code. I thought that it would be nice to be able to use an API that you would already be familiar with (xkeysnail's). However, I realized that the key code values provided by xkeysnail are wrong because the keycodes used by windows and x are different.

I wrote a small helper keysnail_helper.py that subclasses/monkey-patches the Key, Modifier, and Combo classes from xkeysnail.

Usage is as follows:

from keysnail_helper import K

my_key = K("LC-C")
for modifier in my_key.modifiers:
    print(modifier.get_key().value)

print(my_key.key.value)

The values I get correspond with what's listed on MSDN Obviously I haven't built out any of the actual logic yet, but this is a start to being able to have shared keymaps from xkeysnail get generated as powertoys configs.