Index | Thread | Search

From:
Jethro Gibbons <jg-openbsd@proton.me>
Subject:
Add British "Colemak" keyboard layout (uk.colemak)
To:
"tech@openbsd.org" <tech@openbsd.org>
Date:
Wed, 06 Mar 2024 13:12:41 +0000

Download raw body.

Thread
Hi,

Diffs to add the British "Colemak" keyboard layout (uk.colemak) and
update the relevant man pages.

Cheers,

Jethro Gibbons





diff --git a/share/man/man4/pckbd.4 b/share/man/man4/pckbd.4
index 507d733777a..bff21a7bfe7 100644
--- a/share/man/man4/pckbd.4
+++ b/share/man/man4/pckbd.4
@@ -158,6 +158,11 @@ Ukrainian in
 .It KB_UK
 .Pq uk
 British.
+.It KB_UK | KB_COLEMAK
+.Pq uk.colemak
+British keyboard with
+.Dq Colemak
+layout.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
@@ -184,8 +189,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,
-KB_US | KB_DVORAK and KB_US | KB_COLEMAK
+The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_UK | KB_COLEMAK,
+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 3c14d2ec96e..9c06ca4099c 100644
--- a/share/man/man4/ukbd.4
+++ b/share/man/man4/ukbd.4
@@ -195,6 +195,11 @@ Ukrainian in
 .It KB_UK
 .Pq uk
 British.
+.It KB_UK | KB_COLEMAK
+.Pq uk.colemak
+British keyboard with
+.Dq Colemak
+layout.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
@@ -217,8 +222,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,
-KB_US | KB_DVORAK and KB_US | KB_COLEMAK
+The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK,
+KB_UK | KB_COLEMAK, 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/usb/ukbdmap.c b/sys/dev/usb/ukbdmap.c
index f17f9a7f654..610e0f2ec93 100644
--- a/sys/dev/usb/ukbdmap.c
+++ b/sys/dev/usb/ukbdmap.c
@@ -476,6 +476,44 @@ static const keysym_t ukbd_keydesc_uk[] = {
     KC(100),   KS_backslash,   KS_bar,     KS_Udiaeresis,
 };

+static const keysym_t ukbd_keydesc_uk_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(30), KS_1,       KS_exclam,   KS_plusminus,   KS_exclamdown,
+    KC(31), KS_2,       KS_quotedbl, KS_twosuperior, KS_cent,
+    KC(32), KS_3,       KS_sterling, KS_threesuperior,
+    KC(33), KS_4,       KS_dollar,   KS_acute,       KS_currency,
+    KC(34), KS_5,       KS_percent,  KS_mu,          KS_yen,
+    KC(35), KS_6,       KS_asciicircum, KS_paragraph,
+    KC(36), KS_7,       KS_ampersand,   KS_periodcentered, KS_brokenbar,
+    KC(37), KS_8,       KS_asterisk,    KS_cedilla,     KS_ordfeminine,
+    KC(38), KS_9,       KS_parenleft,   KS_onesuperior, KS_diaeresis,
+    KC(39), KS_0,       KS_parenright,  KS_masculine,   KS_copyright,
+    KC(45), KS_minus,   KS_underscore,  KS_hyphen,  KS_ssharp,
+    KC(46), KS_equal,   KS_plus,        KS_onehalf, KS_guillemotleft,
+    KC(49), KS_numbersign,  KS_asciitilde,  KS_sterling,    KS_thorn,
+    KC(50), KS_numbersign,  KS_asciitilde,  KS_sterling,    KS_thorn,
+    KC(51), KS_o,
+    KC(52), KS_apostrophe,  KS_at,      KS_section, KS_Agrave,
+    KC(53), KS_grave,       KS_grave,   KS_agrave,  KS_agrave,
+    KC(100), KS_backslash,  KS_bar,     KS_Udiaeresis,
+};
+
 static const keysym_t ukbd_keydesc_jp[] = {
 /*  pos      normal        shifted     altgr       shift-altgr */
     KC(31),    KS_2,       KS_quotedbl,
@@ -1199,6 +1237,7 @@ const struct wscons_keydesc ukbd_keydesctab[] = {
    KBD_MAP(KB_DK | KB_NODEAD,  KB_DK,  ukbd_keydesc_dk_nodead),
    KBD_MAP(KB_IT,          KB_US,  ukbd_keydesc_it),
    KBD_MAP(KB_UK,          KB_US,  ukbd_keydesc_uk),
+   KBD_MAP(KB_UK | KB_COLEMAK, KB_US,  ukbd_keydesc_uk_colemak),
    KBD_MAP(KB_JP,          KB_US,  ukbd_keydesc_jp),
    KBD_MAP(KB_SV,          KB_DK,  ukbd_keydesc_sv),
    KBD_MAP(KB_SV | KB_NODEAD,  KB_SV,  ukbd_keydesc_sv_nodead),





diff --git a/sys/dev/pckbc/wskbdmap_mfii.c b/sys/dev/pckbc/wskbdmap_mfii.c
index f945f4517c2..f929a6146a3 100644
--- a/sys/dev/pckbc/wskbdmap_mfii.c
+++ b/sys/dev/pckbc/wskbdmap_mfii.c
@@ -407,6 +407,43 @@ static const keysym_t pckbd_keydesc_uk[] = {
     KC(86),  KS_backslash, KS_bar,     KS_Udiaeresis,
 };

+static const keysym_t pckbd_keydesc_uk_colemak[] = {
+/*  pos      command        normal      shifted */
+    KC(2),   KS_1,      KS_exclam,     KS_plusminus,      KS_exclamdown,
+    KC(3),   KS_2,      KS_quotedbl,   KS_twosuperior,    KS_cent,
+    KC(4),   KS_3,      KS_sterling,   KS_threesuperior,
+    KC(5),   KS_4,      KS_dollar,     KS_acute,          KS_currency,
+    KC(6),   KS_5,      KS_percent,    KS_mu,             KS_yen,
+    KC(7),   KS_6,      KS_asciicircum, KS_paragraph,
+    KC(8),   KS_7,      KS_ampersand,  KS_periodcentered, KS_brokenbar,
+    KC(9),   KS_8,      KS_asterisk,   KS_cedilla,       KS_ordfeminine,
+    KC(10),  KS_9,      KS_parenleft,  KS_onesuperior,    KS_diaeresis,
+    KC(11),  KS_0,      KS_parenright, KS_masculine,      KS_copyright,
+    KC(12),  KS_minus,  KS_underscore, KS_hyphen,         KS_ssharp,
+    KC(13),  KS_equal,  KS_plus,       KS_onehalf,     KS_guillemotleft,
+    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(40),  KS_apostrophe, KS_at,         KS_section,  KS_Agrave,
+    KC(41),  KS_grave,      KS_grave,      KS_agrave,   KS_agrave,
+    KC(43),  KS_numbersign, KS_asciitilde, KS_sterling, KS_thorn,
+    KC(49),  KS_k,
+    KC(86),  KS_backslash,  KS_bar,        KS_Udiaeresis,
+};
+
 static const keysym_t pckbd_keydesc_jp[] = {
 /*  pos      normal        shifted     altgr       shift-altgr */
     KC(3),   KS_2,     KS_quotedbl,
@@ -1142,6 +1179,7 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
    KBD_MAP(KB_DK | KB_NODEAD,  KB_DK,  pckbd_keydesc_dk_nodead),
    KBD_MAP(KB_IT,          KB_US,  pckbd_keydesc_it),
    KBD_MAP(KB_UK,          KB_US,  pckbd_keydesc_uk),
+   KBD_MAP(KB_UK | KB_COLEMAK,     KB_US,  pckbd_keydesc_uk_colemak),
    KBD_MAP(KB_JP,          KB_US,  pckbd_keydesc_jp),
    KBD_MAP(KB_SV,          KB_DK,  pckbd_keydesc_sv),
    KBD_MAP(KB_SV | KB_NODEAD,  KB_SV,  pckbd_keydesc_sv_nodead),