Automatic defsrc generation kanata --defsrc
#1597
mauricioprado00
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I like the feature idea. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So my first "issue" is that I need to map all my keys, but there is no clear way to know the codes. I used the --debug option but for example it was logging
Grave
but notgrv
. It did read the value (41) . I see it is possible to navigate through the source codehttps://github.com/jtroo/kanata/blob/main/parser/src/keys/mod.rs
to find out the key names, however it is rather clumsy way to figure out each key.I think this could be easily solved with a new flag for the commanline tool that works as follows:
kanata --defsrc # generates a config file with the keyboard layout
then you get a message:
then you follow the instructions, the system will record only the key presses, and maybe emmit some kind of feedback like a count of keys and current row.
The system should simply do:
"grab"
the input keyboard, and acqire the input and "mute". so that key presses don't accidentally trigger anything that takes the focus out from the terminal window. like<meta>
opening the linux/windows menu.ioctl(fd, EVIOCGRAB, 1)
is what I mean for linux.a
to put the new "clean" array with values.e
to track end of rows.r=0
l = null
v
holds current value. iterate only from 0 to len-8 (the last 8 ones are the exit)v != l && r>=4
thene[len(e)]=len(a)
v == l
thenr++
otherwiser=0
v != l
then adda[len(a)] = v
at the end of that algorith there will be
a
an array of all key code valuese
an array of the indexes where each of the rows endthat should allow you to output to the console (or a file) the mapping to a defsrc.
Beta Was this translation helpful? Give feedback.
All reactions