Support for neo2 keyboard layout

Modify aux/kbdfs to work with neo2 layout.
- add new modifier, increase limit on layers.
- Add Kaltgr for mod3
- Add mod4

This change only implements the alphanumeric
block of the keyboard in the kbmap, as neo2
is mainly used for blind typing and is not
needed that much anywhere else, this leaves
the numpad like it is.

(Thanks, jstsmthrgk@jstsmthrgk.eu)
This commit is contained in:
Ori Bernstein 2020-04-25 20:46:45 -07:00
parent 2614fa02f7
commit d6598a2a31

View file

@ -42,6 +42,7 @@ struct Scan {
int ctl; int ctl;
int alt; int alt;
int altgr; int altgr;
int mod4;
int leds; int leds;
}; };
@ -285,6 +286,46 @@ Rune kbtabshiftaltgr[Nscan] =
[0x78] 0, 0, 0, 0, 0, 0, 0, 0, [0x78] 0, 0, 0, 0, 0, 0, 0, 0,
}; };
Rune kbtabmod4[Nscan] =
{
[0x00] 0, 0, 0, 0, 0, 0, 0, 0,
[0x08] 0, 0, 0, 0, 0, 0, 0, 0,
[0x10] 0, 0, 0, 0, 0, 0, 0, 0,
[0x18] 0, 0, 0, 0, 0, 0, 0, 0,
[0x20] 0, 0, 0, 0, 0, 0, 0, 0,
[0x28] 0, 0, 0, 0, 0, 0, 0, 0,
[0x30] 0, 0, 0, 0, 0, 0, 0, 0,
[0x38] 0, 0, 0, 0, 0, 0, 0, 0,
[0x40] 0, 0, 0, 0, 0, 0, 0, 0,
[0x48] 0, 0, 0, 0, 0, 0, 0, 0,
[0x50] 0, 0, 0, 0, 0, 0, 0, 0,
[0x58] 0, 0, 0, 0, 0, 0, 0, 0,
[0x60] 0, 0, 0, 0, 0, 0, 0, 0,
[0x68] 0, 0, 0, 0, 0, 0, 0, 0,
[0x70] 0, 0, 0, 0, 0, 0, 0, 0,
[0x78] 0, 0, 0, 0, 0, 0, 0, 0,
};
Rune kbtabaltgrmod4[Nscan] =
{
[0x00] 0, 0, 0, 0, 0, 0, 0, 0,
[0x08] 0, 0, 0, 0, 0, 0, 0, 0,
[0x10] 0, 0, 0, 0, 0, 0, 0, 0,
[0x18] 0, 0, 0, 0, 0, 0, 0, 0,
[0x20] 0, 0, 0, 0, 0, 0, 0, 0,
[0x28] 0, 0, 0, 0, 0, 0, 0, 0,
[0x30] 0, 0, 0, 0, 0, 0, 0, 0,
[0x38] 0, 0, 0, 0, 0, 0, 0, 0,
[0x40] 0, 0, 0, 0, 0, 0, 0, 0,
[0x48] 0, 0, 0, 0, 0, 0, 0, 0,
[0x50] 0, 0, 0, 0, 0, 0, 0, 0,
[0x58] 0, 0, 0, 0, 0, 0, 0, 0,
[0x60] 0, 0, 0, 0, 0, 0, 0, 0,
[0x68] 0, 0, 0, 0, 0, 0, 0, 0,
[0x70] 0, 0, 0, 0, 0, 0, 0, 0,
[0x78] 0, 0, 0, 0, 0, 0, 0, 0,
};
char* char*
dev(char *file) dev(char *file)
{ {
@ -368,6 +409,10 @@ kbdputsc(Scan *scan, int c)
key.r = kbtabshiftesc1[c]; key.r = kbtabshiftesc1[c];
else if(scan->esc1) else if(scan->esc1)
key.r = kbtabesc1[c]; key.r = kbtabesc1[c];
else if(scan->altgr && scan->mod4 && kbtabaltgrmod4[c] != 0)
key.r = kbtabaltgrmod4[c];
else if(scan->mod4 && kbtabmod4[c] != 0)
key.r = kbtabmod4[c];
else if(scan->shift && scan->altgr && kbtabshiftaltgr[c] != 0) else if(scan->shift && scan->altgr && kbtabshiftaltgr[c] != 0)
key.r = kbtabshiftaltgr[c]; key.r = kbtabshiftaltgr[c];
else if(scan->shift) else if(scan->shift)
@ -403,6 +448,9 @@ kbdputsc(Scan *scan, int c)
case Kaltgr: case Kaltgr:
scan->altgr = key.down; scan->altgr = key.down;
break; break;
case Kmod4:
scan->mod4 = key.down;
break;
case Kalt: case Kalt:
scan->alt = key.down; scan->alt = key.down;
break; break;
@ -470,6 +518,8 @@ Nextmsg:
a->shift = k.down; a->shift = k.down;
else if(k.r == Kaltgr) else if(k.r == Kaltgr)
a->altgr = k.down; a->altgr = k.down;
else if(k.r == Kmod4)
a->mod4 = k.down;
else if(k.r == Kctl) else if(k.r == Kctl)
a->ctl = k.down; a->ctl = k.down;
send(keychan, &k); send(keychan, &k);
@ -664,6 +714,7 @@ nextrune(Channel *ch, Rune *r)
case Knum: case Knum:
case Kshift: case Kshift:
case Kaltgr: case Kaltgr:
case Kmod4:
/* ignore modifiers */ /* ignore modifiers */
continue; continue;
@ -1081,6 +1132,8 @@ kbmapent(int t, int sc)
/* 5 */ kbtabctrlesc1, /* 5 */ kbtabctrlesc1,
/* 6 */ kbtabshiftesc1, /* 6 */ kbtabshiftesc1,
/* 7 */ kbtabshiftaltgr, /* 7 */ kbtabshiftaltgr,
/* 8 */ kbtabmod4,
/* 9 */ kbtabaltgrmod4,
}; };
if(t >= 0 && t < nelem(tabs) && sc >= 0 && sc < Nscan) if(t >= 0 && t < nelem(tabs) && sc >= 0 && sc < Nscan)
return &tabs[t][sc]; return &tabs[t][sc];
@ -1116,6 +1169,7 @@ kbcompat(Rune r)
static Rune o = Spec|0x60, tab[] = { static Rune o = Spec|0x60, tab[] = {
Kshift, Kbreak, Kctl, Kalt, Kshift, Kbreak, Kctl, Kalt,
Kcaps, Knum, Kmiddle, Kaltgr, Kcaps, Knum, Kmiddle, Kaltgr,
Kmod4,
}; };
if(r >= o && r < o+nelem(tab)) if(r >= o && r < o+nelem(tab))
return tab[r - o]; return tab[r - o];