XKB layout cycling #954
postsolar
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
If one were willing to use a Note (untested):
The disadvantage is extra memory consumed by the duplicated qwerty layers, I would guess in the range of 50-200 KB per layer - though I should calculate this precisely some day 😄 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been struggling for a while with making Kanata play nice with multiple keyboard layouts, including layouts not based on the Latin alphabet. Now that I came up with a solution that feels more or less alright, I decided to share it with the community.
Unfortunately this is somewhat specific (perhaps inherently so) to my setup, so one would need to adapt it to their own environment in order to use it.
Problem
If Kanata is used to define a custom layout (eg Colemak), it's all nice as long as it's the only layout used. Using other layouts exposes us to some issues:
(unicode …)
is unreliableTo sum it up, I want Kanata to provide me a custom layout for English language but not interfere with anything else.
Solution
1. Define a layer which corresponds to the underlying keyboard (i.e.
defsrc
and maybe some mods)2. Define a
@nlo
(next layout) alias which would trigger layout cyclingIn the previous section, I chose right alt to put this key on, but obviously you're free to put it anywhere you'd like.
3. Create a TCP client which would listen to the messages sent by Kanata and act on them
I chose ZSH to implement it because it appears to be faster than netcat while still being a good choice for a small IO-oriented script. I use Hyprland so switching the XKB layout for me would involve
hyprctl
. Dependencies includeripgrep
andfx
(could be substituted withjq
, if you prefer that).layout-switcher.zsh
4. Start kanata with a dedicated port for the TCP client and start the script
If you have suggestions on how to simplify this, please share!
Beta Was this translation helpful? Give feedback.
All reactions