Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Mar 2004 23:18:42 -0700
From:      Dan MacMillan <flowers@users.sourceforge.net>
To:        freebsd-questions@FreeBSD.ORG
Subject:   kbdcontrol -f and escape sequences
Message-ID:  <FGEIJLCPFDNMGDOKNBABOEMBCHAA.flowers@users.sourceforge.net>

next in thread | raw e-mail | index | archive | help
Hello,

I'm having some trouble using kbdcontrol to redefine function keys to
strings that include escape sequences.  For example, suppose I want to
redefine "F1" to be equivalent to pressing the left arrow key twice in a
row.  I naiively thought this would work:

    kbdcontrol -f 1 "\033[D\033[D"

However, that just causes the literal string "\033[D\033[D" to be printed
verbatim when I press F1.  I tried a few variations on this theme but was
unsuccessful.

I know the architecture allows what I want because I was able to change the
source code to kbdcontrol to set the default values of the function keys (in
the fkey_table[][] array) to be what I want:

    /* 01-04 */ "\033[D\033[D","\033[N","\033[O","\033[P",

and then cause the values to be defined by running:

    kbdcontrol -F

Clearly, though, that "solution" has no legs.  I know (think?) there's got
to be a way to do this using the standard kbdcontrol utility, and I'm
probably just not escaping my escape sequences properly on the command line,
but I'm just not grokking it.

-
Danny MacMillan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FGEIJLCPFDNMGDOKNBABOEMBCHAA.flowers>