jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
2.92k stars 125 forks source link

[Feature Request] `ultikeys` as default layout to read from for `kanata` to make the us-layout universal #1246

Closed zenny closed 1 month ago

zenny commented 1 month ago

Is your feature request related to a problem? Please describe.

The standard US keyboard cannot print different glyphs used in the European languages. Specific European keyboards have extra keys, good for linguistic purpose, but not convenient to work with general text and coding simultaneously as the distances are too far and in unusual locations. But ultikeys (https://github.com/pieter-degroote/UltimateKEYS) layout supports all latin-based languages without disarranging the us-layout.

Describe the solution you'd like.

So how wonderful it be wonderful to keep the ultikeys layout the default layout to read from in kanata?

Describe alternatives you've considered.

Currently, I switch between ultkeys (that supports all latin-based European languages with different glyphs, see https://github.com/pieter-degroote/UltimateKEYS), Greek (gr) layout for mathematical notations, Pali-Sanskrit (pi) for oriental inscription ( https://github.com/bdhrs/pali-sanksrit-keyboard-for-linux) and Arabic (ar) for Arabic layout (sometimes 12 different scripts, not languages), and toggle between them by pressing Ctrl_R and Shift_R in a 104-key US keyboard by running:

xset r rate 300 50
xmodmap -e 'keycode 66 = Control_R' -e "clear lock"
killall xcape 2>/dev/null ; xcape -e 'Control_R=Escape'
setxkbmap -layout ultkeys,gr,pi,ar -option grp:rctrl_rshift_toggle,caps:ctrl_modifier

Additional context

Advantages

  1. This shall make easier for the European language users not needing to switch between different hardware layouts as the same US layout serves all latin-based languages.
  2. The coders who have to use European languages find it efficient as the keys are universally and ergonomically accessible without pressing extra keys like in Nordic keyboard, in order to print ~ on has to press AltGr+two times an extra key that lies next to the ] which is not found in us-layout.

Please refer to the discussion in https://github.com/jtroo/kanata/discussions/1245. Thanks.

jtroo commented 1 month ago

On Linux the input handling model from physical input to application goes something like this (order is relevant)

physical keyboard -> kernel -> desktop env -> application

Kanata and ultikeys are at kernel and userspace respectively

physical keyboard -> kernel -> desktop env -> application
                     kanata      ultikeys

At the kernel layer Kanata captures+re-sends device events. Kanata always operates on US-layout input codes. xkb, xmodmap and other tools read Kanata's outputs to transform the US-layout kernel outputs to the ultikeys layout, or whichever desktop environment layout is active.

With this context, it's not clear to me what this is supposed to mean:

keep the ultikeys layout the default layout to read from in kanata?

If you run Kanata while remapping nothing and use ultikeys, your input should already behave as if Kanata wasn't running at all, and you should be typing in the ultikeys layout.

(defcfg process-unmapped-keys yes)
(defsrc)
(deflayer base)
zenny commented 1 month ago

On Linux the input handling model from physical input to application goes something like this (order is relevant)

physical keyboard -> kernel -> desktop env -> application

Kanata and ultikeys are at kernel and userspace respectively

physical keyboard -> kernel -> desktop env -> application
                     kanata      ultikeys

At the kernel layer Kanata captures+re-sends device events. Kanata always operates on US-layout input codes. xkb, xmodmap and other tools read Kanata's outputs to transform the US-layout kernel outputs to the ultikeys layout, or whichever desktop environment layout is active.

@jtroo Thanks for taking time to elaborate. After running kanata, the remaining kernelspace layouts other than ultikeys were cycled and loaded after pressing right_ctrl+right_shift as expected:

setxkbmap -layout ultkeys,gr,pi,ar -option grp:rctrl_rshift_toggle,caps:ctrl_modifier

With this context, it's not clear to me what this is supposed to mean:

keep the ultikeys layout the default layout to read from in kanata?

If you run Kanata while remapping nothing and use ultikeys, your input should already behave as if Kanata wasn't running at all, and you should be typing in the ultikeys layout.

Thanks.

(defcfg process-unmapped-keys yes)
(defsrc)
(deflayer base)