Re: [PATCH v2] Add Backtab keysym and update keymaps to use it for Shift+Tab

Alexey Gladkov <[email protected]> Fri, 20 Feb 2026 14:02:41 +0100
Newsgroups dev.linux.lists.kbd
Message-ID <[email protected]>
On Tue, Feb 17, 2026 at 12:28:35PM -0500, Nicolas Pitre wrote:
> Add a new Backtab keysym (KT_FN index 30) that produces the standard
> backtab escape sequence \e[Z. This replaces F246 which was unused.
> 
> Update all keymaps to use Backtab for Shift+Tab instead of Meta_Tab.
> In most cases the Meta_Tab binding already existed for Alt+Tab; where
> it was missing, it has been added.
> 
> This change affects keymaps across all architectures: i386, amiga,
> atari, mac, sun, and pine.
> 
> Signed-off-by: Nicolas Pitre <[email protected]>

Sorry for the delay. This change is user visible and my tests broke.

> diff --git a/src/libkeymap/parser.y b/src/libkeymap/parser.y
> index 2cd509f..fcb8c9b 100644
> --- a/src/libkeymap/parser.y
> +++ b/src/libkeymap/parser.y
> @@ -79,7 +79,7 @@ static int
>  strings_as_usual(struct lk_ctx *ctx)
>  {
>  	/*
> -	 * 26 strings, mostly inspired by the VT100 family
> +	 * 27 strings, mostly inspired by the VT100 family
>  	 */
>  	const char *stringvalues[] = {
>  		/* F1 .. F20 */
> @@ -90,8 +90,8 @@ strings_as_usual(struct lk_ctx *ctx)
>  		"\033[31~", "\033[32~", "\033[33~", "\033[34~",
>  		/* Find,    Insert,     Remove,     Select,     Prior */
>  		"\033[1~",  "\033[2~",  "\033[3~",  "\033[4~",  "\033[5~",
> -		/* Next,    Macro,      Help,       Do,         Pause */
> -		"\033[6~",  NULL,       NULL,       NULL,       NULL
> +		/* Next,    Macro,      Help,       Do,         Pause,    Backtab */
> +		"\033[6~",  NULL,       NULL,       NULL,       NULL,     "\033[Z"
>  	};
>  	unsigned char i;
>  
> diff --git a/src/libkeymap/syms.ktyp.h b/src/libkeymap/syms.ktyp.h
> index 82c87a6..cd0404c 100644
> --- a/src/libkeymap/syms.ktyp.h
> +++ b/src/libkeymap/syms.ktyp.h
> @@ -278,6 +278,7 @@ static const char *const fn_syms[] = {
>  	"Help",
>  	"Do",
>  	"Pause",
> +	"Backtab",
>  	"F21", "F22", "F23", "F24", "F25",
>  	"F26", "F27", "F28", "F29", "F30",
>  	"F31", "F32", "F33", "F34", "F35",

I noticed that this change complicates the use of the uapi kernel. You
added a value in the middle and shifted the other values. So K_F21 became
"Backtab", and K_F22 in kbd is named "F21", and so on.

This will confuse users.

ioctl(<fd>, KDSKBSENT, {kb_func=KVAL(K_PGUP), kb_string="\33[5~"}) = 0
ioctl(<fd>, KDSKBSENT, {kb_func=KVAL(K_PGDN), kb_string="\33[6~"}) = 0
ioctl(<fd>, KDSKBSENT, {kb_func=KVAL(K_F21), kb_string="\33[Z"}) = 0

$ grep -A1 -B1 -w K_F21 include/uapi/linux/keyboard.h
#define K_PAUSE         K(KT_FN,29)
#define K_F21           K(KT_FN,30)
#define K_F22           K(KT_FN,31)

> @@ -323,7 +324,7 @@ static const char *const fn_syms[] = {
>  	"F231", "F232", "F233", "F234", "F235",
>  	"F236", "F237", "F238", "F239", "F240",
>  	"F241", "F242", "F243", "F244", "F245",
> -	"F246" /* there are 10 keys named Insert etc., total 256 */
> +	/* 11 keys named Find through Backtab, total 256 */
>  };
>  
>  /*
> 

-- 
Rgrds, legion