Изменение мета-ключа для библиотеки readline

379
wafflecat

Я заинтересован в том, чтобы связать metaключ для библиотеки readline (редактирование командной строки, скажем, в bash) от клавиши alt с каким-то другим произвольным ключом (например, клавишей caps lock).

Для контекста, я уже использую менеджер окон XMonad, и у меня есть клавиша alt, связанная с рядом пользовательских функций, которые имеют приоритет над сочетаниями клавиш терминала.

Я пытался использовать xmodmap для переназначения ключа для Escape, но это не позволяет вам удерживать клавишу нажатой и нажимать несколько нажатий подряд.

Возможно ли, чтобы readline рассматривал другой Modмодификатор как мета-ключ?

Спасибо!

1

2 ответа на вопрос

0
Thomas Dickey

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.

0
Jeremy W. Sherman

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.

Похожие вопросы