Index | Thread | Search

From:
Helg <helg-openbsd@gmx.de>
Subject:
Re: ukbdmap: add apple keyboard variant
To:
tech@openbsd.org
Cc:
miod@online.fr
Date:
Tue, 6 Jan 2026 16:14:32 +0100

Download raw body.

Thread
On Sat, Dec 27, 2025 at 02:09:01PM +0100, Helg wrote:
> This patch adds an apple variant to the de keyboard encoding for
> wskdb. It doesn't attempt to map all additional keysyms, only those that
> are required in the shell and for programming.
> 
> It is similar to the applealu_iso variant that can be specified in X11
> with setxkbmap.
> 
> I'd appreciate if other users with German Apple keyboards could test in
> the console. It's now possible to do this:
> 
> wsconsctl keyboard.encoding=de.nodead.apple.metaesc
> 
Update diff. The only change from the previous one is that DE parts our
now before the FR parts.

ok?


Index: makemap.awk
===================================================================
RCS file: /cvs/src/sys/dev/usb/makemap.awk,v
diff -u -p -r1.17 makemap.awk
--- makemap.awk	22 Nov 2023 18:19:25 -0000	1.17
+++ makemap.awk	6 Jan 2026 11:17:42 -0000
@@ -36,6 +36,7 @@ BEGIN {
 	ignore = 0
 	declk = 0
 	haskeys = 0
+	kbde = 0
 	kbfr = 0
 	nmaps = 0
 
@@ -360,6 +361,18 @@ $1 == "#define" || $1 == "#undef" {
 		# Apple black USB keyboards use a slightly different
 		# layout. We define them here.
 		#
+		if (mapname == "ukbd_keydesc_de[]") {
+			print $0
+			print "\nstatic const keysym_t ukbd_keydesc_de_apple[] = {"
+			print "/*  pos\t\tnormal\t\tshifted\t\taltgr\t\tshifted-altgr */"
+			print "    KC(15),\tKS_l,\t\tKS_L,\t\tKS_at,"
+			print "    KC(34),\tKS_5,\t\tKS_percent,\tKS_bracketleft,"
+			print "    KC(35),\tKS_6,\t\tKS_ampersand,\tKS_bracketright,"
+			print "    KC(36),\tKS_7,\t\tKS_slash,\tKS_bar,\t\tKS_backslash,"
+			print "    KC(37),\tKS_8,\t\tKS_parenleft,\tKS_braceleft,"
+			print "    KC(38),\tKS_9,\t\tKS_parenright,\tKS_braceright,"
+			print "    KC(17),\tKS_n,\t\tKS_N,\t\tKS_asciitilde,"
+		} else
 		if (mapname == "ukbd_keydesc_fr[]") {
 			print $0
 			print "\nstatic const keysym_t ukbd_keydesc_fr_apple[] = {"
@@ -412,6 +425,18 @@ $1 == "#define" || $1 == "#undef" {
 			print "    KC(52),\tKS_dead_tilde,\tKS_dead_circumflex"
 		}
 	}
+}
+/KB_DE/ {
+	print $0
+	kbde++
+	# Add .apple variants
+	if (kbde == 1) {
+		print "\tKBD_MAP(KB_DE | KB_APPLE,\tKB_DE,\tukbd_keydesc_de_apple),"
+	} else if (kbde == 2) {
+		print "\tKBD_MAP(KB_DE | KB_APPLE | KB_NODEAD,\tKB_DE | KB_APPLE,"
+		print "\t\tukbd_keydesc_de_nodead),"
+	}
+	next
 }
 /KB_FR/ {
 	print $0