1

I'm interested in rebinding the meta key for the readline library (command line editing in, say, bash) from the alt key to some other arbitrary key (like the caps lock key).

For context, I'm already using the XMonad windows manager and I've got the alt key bound to a number of custom functions that take precedence over the terminal's keybindings.

I've tried using xmodmap to remap a key to Escape, but this does not allow you to hold the key down and hit multiple movement keystrokes in a row.

Is it possible to have readline treat a different Mod modifier as the meta key?

Thanks!

2 Answers 2

0

Readline detects a meta keycombo by checking for a certain bit being set in the character it receives from the terminal, or, because of the way this works out for meta, that the character falls in a certain range of values at the top of the values stored in an 8-bit byte. See chardefs.h for the utility macros involved.

You can adjust its sense of meta-ness by altering the library to detect meta characters in some other way by redefining these macros, and then relinking your shell with this adjusted readline. A less invasive approach would be to configure your terminal to understand another key as setting the meta bit, or using some sort of input manager at the system level that could do the same.

0

The readline library knows exactly nothing about the modifier used in your terminal to act like its notion of a meta key. So, no: what you ask is not possible.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .