chase / awrit

A full graphical web browser for Kitty terminal with mouse and keyboard support
Other
425 stars 14 forks source link

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

Open sinkr opened 3 months ago

sinkr commented 3 months ago

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

chase commented 3 months ago

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.

sinkr commented 3 months ago

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).

chase commented 2 months ago

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?

sinkr commented 1 month ago

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.