When you set up your terminal and system to run in scancode mode, your function keys get set to their default values. If you want to program your function keys while you work in scancode mode, you must use the setkey(C) or mapstr(M) utility, rather than your terminal's setup procedure. The setkey command lets you program one key at a time, while mapstr -f reads a file containing the assignment for all the function keys. These utilities formerly affected only the console.
The syntax for the setkey command is
setkey keynum string.
The setkey command assigns the specified
ANSI string to be the output of the
function key keynum. For example, for function
key 1 (<F1>) to output the string ``date'', use the
command: setkey 1 "date".
For a key assignment to last beyond the current login
session, place the setkey command in your
The syntax for the mapstr command is:
mapstr [-d] [datafile] [-f] [termtype]
Without the -d option, mapstr -f reads the function key values from the file in /usr/lib/keyboard/strings.d that corresponds to the terminal type.
To customize your function key assignments, create a new
file for mapstr to read, using a file from
/usr/lib/keyboard/strings.d as a template.
Then specify your new file in the mapstr command as follows:
mapstr -d newfile -f
For these key assignments to last beyond the current login session, place the mapstr command in your .login file.
For more information, see the scancode(HW) and keyboard(HW) manual pages.