On Tue, 20 Nov 2018 at 19:36:55 -0700, Aaron Bieber wrote:
> On Fri, 16 Nov 2018 at 07:02:42 -0700, Aaron Bieber wrote:
> > On Fri, 16 Nov 2018 at 06:55:09 -0700, Aaron Bieber wrote:
> > > Hi,
> > >
> > > This diff is based off a diff Geert Hendrickx sent to bugs@ back in 2009. 
> > > I
> > > have updated it to add the 'swapctrlcaps' bit and removed the xenocara 
> > > diff.
> > >
> > > https://marc.info/?l=openbsd-bugs&m=124284599329729
> > >
> > > Not sure if this didn't land because it was sent to bugs@ or if there are 
> > > other
> > > reasons. Please cluestick me if you know!
> > >
> > > OK?
> > >
> >
>
> Here is a much cleaner version of the diff which adds proper man
> entries and only modifies the keys that are different from KB_US.
>
> OK?

Ok, here is the latest version, it:

 - Fixes ukbdmap issue I had in the previous diff (spotted by
   thfr). Also ukbdmap's diff is generated via the make target.
 - Includes a diff for xenocara to add a colemak variant.

To test:

 - Apply, Build kernel / reboot
 - # cd /usr/src && make includes
 - # cd /usr/src/sbin/wsconsctl && make obj && make && make install
 - # wsconsctl keyboard.encoding=us.colemak

To test with xenocara:

  - Do above steps
  - Apply xenocara diff
  - Build xenocara as per README
  - Restart X

diff --git a/share/man/man4/pckbd.4 b/share/man/man4/pckbd.4
index 45ad55d8765..0135c715bc0 100644
--- a/share/man/man4/pckbd.4
+++ b/share/man/man4/pckbd.4
@@ -162,6 +162,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DECLK
 .Pq us.declk
 English/US mapping for
@@ -180,7 +185,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4
index af218fa0910..211516596dd 100644
--- a/share/man/man4/ukbd.4
+++ b/share/man/man4/ukbd.4
@@ -198,6 +198,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DVORAK
 .Pq us.dvorak
 English/US keyboard with
@@ -212,8 +217,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and
-KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/sys/dev/pckbc/wskbdmap_mfii.c b/sys/dev/pckbc/wskbdmap_mfii.c
index d10a909eece..8708ef96e11 100644
--- a/sys/dev/pckbc/wskbdmap_mfii.c
+++ b/sys/dev/pckbc/wskbdmap_mfii.c
@@ -597,6 +597,27 @@ static const keysym_t pckbd_keydesc_us_dvorak[] = {
     KC(53),                    KS_z,
 };

+static const keysym_t pckbd_keydesc_us_colemak[] = {
+/*  pos      command           normal          shifted */
+    KC(18),                    KS_f,
+    KC(19),                    KS_p,
+    KC(20),                    KS_g,
+    KC(21),                    KS_j,
+    KC(22),                    KS_l,
+    KC(23),                    KS_u,
+    KC(24),                    KS_y,
+    KC(25),                    KS_semicolon,   KS_colon,
+    KC(31),                    KS_r,
+    KC(32),                    KS_s,
+    KC(33),                    KS_t,
+    KC(34),                    KS_d,
+    KC(36),                    KS_n,
+    KC(37),                    KS_e,
+    KC(38),                    KS_i,           KS_I,
+    KC(39),                    KS_o,
+    KC(49),                    KS_k,
+};
+
 static const keysym_t pckbd_keydesc_swapctrlcaps[] = {
 /*  pos      command           normal          shifted */
     KC(29),                    KS_Caps_Lock,
@@ -1129,6 +1150,7 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
        KBD_MAP(KB_NO | KB_NODEAD,      KB_NO,  pckbd_keydesc_no_nodead),
        KBD_MAP(KB_US | KB_DECLK,       KB_US,  pckbd_keydesc_us_declk),
        KBD_MAP(KB_US | KB_DVORAK,      KB_US,  pckbd_keydesc_us_dvorak),
+       KBD_MAP(KB_US | KB_COLEMAK,     KB_US,  pckbd_keydesc_us_colemak),
        KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER,     KB_US,  pckbd_keydesc_iopener),
        KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK, pckbd_keydesc_swapctrlcaps),
@@ -1139,6 +1161,8 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
        KBD_MAP(KB_BE | KB_SWAPCTRLCAPS, KB_BE, pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_DVORAK | KB_SWAPCTRLCAPS,    KB_US | KB_DVORAK,
                pckbd_keydesc_swapctrlcaps),
+       KBD_MAP(KB_US | KB_COLEMAK | KB_SWAPCTRLCAPS,   KB_US | KB_COLEMAK,
+               pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS,   KB_US | KB_IOPENER,
                pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_ES,                  KB_US,  pckbd_keydesc_es),
diff --git a/sys/dev/usb/ukbdmap.c b/sys/dev/usb/ukbdmap.c
index 3cf1dfe18ed..2e742ab413a 100644
--- a/sys/dev/usb/ukbdmap.c
+++ b/sys/dev/usb/ukbdmap.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ukbdmap.c,v 1.43 2017/06/06 01:02:18 kevlo Exp $      */
+/*     $OpenBSD$       */

 /*
  * THIS FILE IS AUTOMAGICALLY GENERATED.  DO NOT EDIT.
@@ -626,6 +626,27 @@ static const keysym_t ukbd_keydesc_us_dvorak[] = {
     KC(56),    KS_z,
 };

+static const keysym_t ukbd_keydesc_us_colemak[] = {
+/*  pos      command           normal          shifted */
+    KC(7),     KS_s,
+    KC(8),     KS_f,
+    KC(9),     KS_t,
+    KC(10),    KS_d,
+    KC(12),    KS_u,
+    KC(13),    KS_n,
+    KC(14),    KS_e,
+    KC(15),    KS_i,           KS_I,
+    KC(17),    KS_k,
+    KC(18),    KS_y,
+    KC(19),    KS_semicolon,   KS_colon,
+    KC(21),    KS_p,
+    KC(22),    KS_r,
+    KC(23),    KS_g,
+    KC(24),    KS_l,
+    KC(28),    KS_j,
+    KC(51),    KS_o,
+};
+
 static const keysym_t ukbd_keydesc_swapctrlcaps[] = {
 /*  pos      command           normal          shifted */
     KC(57),    KS_Cmd1,        KS_Control_L,
@@ -1179,6 +1200,7 @@ const struct wscons_keydesc ukbd_keydesctab[] = {
        KBD_MAP(KB_NO,                  KB_DK,  ukbd_keydesc_no),
        KBD_MAP(KB_NO | KB_NODEAD,      KB_NO,  ukbd_keydesc_no_nodead),
        KBD_MAP(KB_US | KB_DVORAK,      KB_US,  ukbd_keydesc_us_dvorak),
+       KBD_MAP(KB_US | KB_COLEMAK,     KB_US,  ukbd_keydesc_us_colemak),
        KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER,     KB_US,  ukbd_keydesc_iopener),
        KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK, ukbd_keydesc_swapctrlcaps),
@@ -1191,6 +1213,8 @@ const struct wscons_keydesc ukbd_keydesctab[] = {
        KBD_MAP(KB_BE | KB_SWAPCTRLCAPS, KB_BE, ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_DVORAK | KB_SWAPCTRLCAPS,    KB_US | KB_DVORAK,
                ukbd_keydesc_swapctrlcaps),
+       KBD_MAP(KB_US | KB_COLEMAK | KB_SWAPCTRLCAPS,   KB_US | KB_COLEMAK,
+               ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS,   KB_US | KB_IOPENER,
                ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_ES,                  KB_US,  ukbd_keydesc_es),
diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h
index 486b8840c4f..4a2e7b70d5f 100644
--- a/sys/dev/wscons/wsksymdef.h
+++ b/sys/dev/wscons/wsksymdef.h
@@ -746,6 +746,7 @@
 #define KB_IOPENER             0x00000040 /* f1-f12 -> ESC,f1-f11 */
 #define KB_MACHDEP             0x00000080 /* machine dependent */
 #define KB_APPLE               0x00010000 /* Apple specific layout */
+#define KB_COLEMAK             0x02000000 /* Colemak layout */
 #define KB_DEFAULT             0x80000000 /* (attach-only) default layout */

 #define KB_ENCTAB \
@@ -788,6 +789,7 @@
        { KB_METAESC,   "metaesc" }, \
        { KB_IOPENER,   "iopener" }, \
        { KB_MACHDEP,   "machdep" }, \
-       { KB_APPLE,     "apple" }
+       { KB_APPLE,     "apple" }, \
+       { KB_COLEMAK,   "colemak" }

 #endif /* !_DEV_WSCONS_WSKSYMDEF_H_ */

--------8<--------

And xenocara

diff --git a/xserver/config/wscons.c b/xserver/config/wscons.c
index a0a18f37a..a000f46e4 100644
--- a/xserver/config/wscons.c
+++ b/xserver/config/wscons.c
@@ -65,6 +65,7 @@ struct nameint kbdvar[] = {
     {KB_DVORAK | KB_CF, "fr-dvorak"},
     {KB_DVORAK | KB_FR, "bepo"},
     {KB_DVORAK, "dvorak"},
+    {KB_COLEMAK, "colemak"},
     {KB_CF, "fr-legacy"},
     {KB_NODEAD, "nodeadkeys"},
     {0}

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE

Reply via email to