kbingham / xhk

XLib HalfKeyboard implementation
16 stars 8 forks source link

Is possible to add more 4 key? #14

Closed Moanrisy closed 4 years ago

Moanrisy commented 4 years ago

I wonder If I can change =+ button, [{ button, ]} button, '" button with F1, F2, F3, F4.

From what i'm read from the src folder, there is 2 file. 1 is to enum number with button. from 9 to 66. so If I want to use, (=+, [{, }], '") and (f1, f2, f3, f4) what number should I use?

from method mirror_key() /****

where I can find his keycode?

kbingham commented 4 years ago

Hi, yes you'll need to add a like like this one:

https://github.com/kbingham/xhk/blob/cb19c87abc2150ba2df3811e43eccc25c85a7b4b/src/xhk.c#L245

if(keycode >= KEY_1 && keycode <= KEY_0) t = KEY_1;

But you'll need it to map to KEY _F1 so :

if(keycode >= KEY_F1 && keycode <= KEY_10) t = KEY_F1; // functions

But xhk-layout.h s does not define the values of those KEY _F1,2,3... yet.

I think from memory they are standard X key values, but I can't remember for sure.

I think of you run xhk with debug enabled it will print the keycodes, or you can get them from the xinput libraries.

If you can find the right header in Xinput, we should really include that rather than redefining them ourselves.

kbingham commented 4 years ago

I think you can get the codes from running either showkey or xev too

Moanrisy commented 4 years ago

Thank you very much, it's working.

for future reference, maybe someone want to edit too

  1. run xev
  2. press key (remember the keycodes)
  3. add the keycodes in src/xhk-layout.h
  4. edit src/xhk.c, method mirror_key
  5. recompile again
kbingham commented 4 years ago

Feel free to submit a patch for this if you like :-)

Moanrisy commented 4 years ago

Feel free to submit a patch for this if you like :-)

I will try to make PR on this weekend, I will update README about

and I will try to make PR for 4 new keys SQUARE key [, close SQUARE key ], equal plus =+, and apostrophe key I map F1-F4 from the highest priority key when used on typing. F1 > '" (I map this for F1 because people casually use apostrophe when typing common text) F2 > [{ (for coding) F3 > ]} (for coding) F4 > =+ (maybe someone use this key)