awrit icon indicating copy to clipboard operation
awrit copied to clipboard

v1.0.0 + macOS Sonama + Kitty 0.34.1 + Dvorak == Qwerty

Open sinkr opened this issue 1 year ago • 4 comments

Hi, thanks for the software. Any idea how to mitigate this? I'll keep looking, but everything else in the terminal is in Dvorak.

sinkr avatar May 08 '24 15:05 sinkr

The raw key codes are being transmitted and translated to the corresponding defaults for Windows keys codes which Chromium uses.

That said, I can't think of a good workaround for this because ultimately there's no way to translate the Kitty key codes to the appropriate Windows key codes for every possible layout.

This is probably something I won't get around to fixing, but you're welcome to fix this yourself and contribute a PR.

chase avatar May 10 '24 08:05 chase

Thank you for the response. I did a little digging and the rough TLDR is that (I think) this comes down to CSI u, which is very well documented at the Kitty site.

He offers a kitten that, when run shows the actual key pressed and its alternate.

So, as an example for me in Dvorak, the physical n key on my keyboard is translated into becoming the b key. Hence, when I run the kitten kitten show_key -m kitty, and press the physical n key, this output is produced:

b PRESS b
CSI 98 :  : 110 ;  ; 98 u
Alternate key: n

b RELEASE
CSI 98 :  : 110 ; 1 : 3 u
Alternate key: n

So, back to your original assertion, a code change needs to be made to read the CSI u value (a.k.a. the alternate key).

sinkr avatar May 10 '24 14:05 sinkr

Thank you for the response. I did a little digging and the rough TLDR is that (I think) this comes down to CSI u, which is very well documented at the Kitty site.

He offers a kitten that, when run shows the actual key pressed and its alternate.

So, as an example for me in Dvorak, the physical n key on my keyboard is translated into becoming the b key. Hence, when I run the kitten kitten show_key -m kitty, and press the physical n key, this output is produced:

b PRESS b
CSI 98 :  : 110 ;  ; 98 u
Alternate key: n

b RELEASE
CSI 98 :  : 110 ; 1 : 3 u
Alternate key: n

So, back to your original assertion, a code change needs to be made to read the CSI u value (a.k.a. the alternate key).

As I'm working on porting Awrit over to Electron, I'm trying to improve the key handling as I go, so I figured I'd tackle this as well.

Just to be clear, since I'm not quite sure what's going wrong for you:

Using Dvorak, you're pressing the physical n key, but when you type, you expect it to be b and not n, correct? In that case you wouldn't want the character from the alternate key, as that's the physical key?

chase avatar Jun 30 '24 08:06 chase

Using Dvorak, you're pressing the physical n key, but when you type, you expect it to be b and not n, correct? In that case you wouldn't want the character from the alternate key, as that's the physical key?

In Dvorak, when I press the phsical n key, I want a b to appear.

As it stands right now, my keyboard effectively gets remapped back to QWERTY in awrit.

sinkr avatar Jul 01 '24 14:07 sinkr