rbreaves / kinto

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

How to swap win key with alt when using windows keyboard #834

Closed hoarse-boy closed 9 months ago

hoarse-boy commented 9 months ago

Hello, great software. i have been searching this for almost a year. before that i configure my own using autohotkey, and microsoft powertoys and it was a disaster.

question

how can i swap the win key and alt key? i use windows and also windows keyboard and i chose keybaord in kinto.

btw, there is no problem at all for how the key behaves for all of the keys changed by kinto. but it was just the position that need to be swapped.

when i installed kinto to my windows, the 'physical Ctrl' becomes win key which cannot be used to change tab, nvim control key, etc like in my mac. which should be the 'Virtual Alt'.

i have tried using my keybaord software (royal kludge) to swap both keys and powertoys, but it didnt have any effect.

images

kinto changes

image

windows keyboard

image

mac keyboard

image
RedBearAK commented 9 months ago

@jourdy-mago

(I am not the Kinto dev, just a fellow user and minor contributor.)

The way you've asked the question leaves it a bit unclear what you want to accomplish, but you mentioned "nvim", which I assume is where you're having the problem with the physical Ctrl key not being Ctrl.

Normally Kinto will change the modifier remap when you are in a "terminal" so that the physical Ctrl key becomes LCtrl again. That usually works in the well-known "command prompt" types of apps in Windows. If the way you are using "nvim" is in a window that is not recognized as a "terminal", you'll need to find the "class" or the executable name of the window and add it to the appropriate place in your kinto.ahk config file, where the "terminals" group is defined. That should make it work as expected after changing the config and restarting Kinto.

See the lines here in the default config file:

https://github.com/rbreaves/kinto/blob/6f42c68e4b9d2988bd26aafcc42640cc63057fa7/windows/kinto.ahk#L134-L148

hoarse-boy commented 9 months ago

hello, @RedBearAK. thanks for the reply.

sorry if it is unclear to you. i will make it simple.

i just want to swap the win/super with alt

kinto default changes

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

the result i want

GUI Physical Ctrl Win/Alt Alt/Cmd Spacebar
Virtual Alt Win/Super* RCtrl Spacebar
RedBearAK commented 9 months ago

@jourdy-mago

That may be complicated. There are various places in the config file that get commented/uncommented by the toggle script when you change the keyboard type. But mainly here, the modifiers are changed to different modifiers when using a Windows keyboard:

https://github.com/rbreaves/kinto/blob/6f42c68e4b9d2988bd26aafcc42640cc63057fa7/windows/kinto.ahk#L354-L360

However, in most cases what you want to do is make a change specifically for the window where you're having the issue. So again it's a question of what kind of window it is (class or executable).

It's hard to understand why you'd want physical Ctrl to be logical Alt, but I don't spent much time in windows using things like nvim in a terminal, so I'm not the expert here. For terminal apps in macOS, they would see Ctrl from the physical Ctrl key, so normally the way Kinto defines the modifiers in terminals works pretty well.

hoarse-boy commented 9 months ago

@RedBearAK

it is not solely for nvim though. the tab switching in browser, delete a word (option + backspace), cursor movement per word (option + arrow keys (left or right)), etc. they are all effected.

for example to tab swithcing in mac os, i need to click "mac os' control" and "tab". in windows after installing kinto it should be in the same position which are "windows' Ctrl" and "tab". but it was "win key" and "tab" instead.

image

if i can swap those two keys, it will be identical to mac os key binding almost 100%.

and that's the reason why i want to swap those two keys.

RedBearAK commented 9 months ago

@jourdy-mago

it is not solely for nvim though. the tab switching in browser, delete a word (option + backspace), cursor movement per word (option + arrow keys (left or right)), etc. they are all effected.

Hmm, you did mention that before. I never used Ctrl+Tab to tab navigation myself, but I thought there were some remaps specifically for that (to remap the logical Win+Tab shortcut back to Ctrl+Tab). That doesn't sound normal if you have a Windows keyboard and chose "Windows" in the tray icon menu, for the keyboard type. Other words for the "Windows" key are Meta or Super, and that key on the keyboard on PC keyboards is supposed to become "left Alt", which means it shouldn't be performing tab navigation. If anything, it should do application switching, since it should logically be "Alt+Tab".

I have come to use Shift+Cmd+Braces (the bracket keys) for tab navigation in browsers, file managers, and most other tabbed UI apps that I use (and Cmd+Braces for back/forward history navigation). I spend almost all my time on Linux, but I've contributed to Kinto on the Windows side to make sure these shortcuts work in Windows Explorer and browsers.

Are you sure you've disabled all other methods of remapping modifier keys? If you have a standard PC keyboard, the Meta key really shouldn't be doing "Ctrl+Tab" tab navigation. It seems like you aren't actually getting the correct modifier positions to begin with.

In short what I'm saying is that you shouldn't be having this problem unless something else is moving your modifier keys either before or after Kinto does its remapping.

I had a user of my own project (a variant on Kinto) using an ~/.Xmodmap to remap modifiers and it had an affect like this, where the behavior of the keyboard did not make sense until that was disabled.

hoarse-boy commented 9 months ago

@RedBearAK

In short what I'm saying is that you shouldn't be having this problem unless something else is moving your modifier keys either before or after Kinto does its remapping.

makes sense. i will check on it. thanks for the input.

hoarse-boy commented 9 months ago

i found a file named Scanmode Map in Keyboard layout of windows registry. i think it was a file left after alot of thinkering of mine to change the keybinding and forgot to delete that.

and now kinto works flawlessly. thanks @RedBearAK

will close the issue.

RedBearAK commented 9 months ago

@jourdy-mago

i found a file named Scanmode Map in Keyboard layout of windows registry. i think it was a file left after alot of thinkering of mine to change the keybinding and forgot to delete that.

That is what I suspected. You should be OK now. 👍🏽