Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #228464
| From | Thomas George <lists@tomgeorge.info> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Special Key Assignment? |
| Date | 2020-11-04 20:50 +0100 |
| Message-ID | <B7wX8-2Z3-17@gated-at.bofh.it> (permalink) |
| References | <B652W-3mS-7@gated-at.bofh.it> <B6I4h-4Br-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Thanks, Greg, I am clearly exploring territory I don't fully understand.
cd F5 displays as cd ~ and takes me to my home directory if entered.
xmodmap -e "keycode 71 = U2660 U2664 U2665 U2667" changes F5 to the
unicode spade symbol as seen below. shift F5 produces the outline spade
symbol. I have not found any modifier key of F5 for the final two unicodes.
This change of the F5 key works in terminals, in LibreOffice Writer, and
in emails.
Even so it is really not a good idea. For example, it blocks the use of
F5 in Idle.
Perhaps there are better choices. There are some strange keys on the
Logitech keyboard that I never have had occasion to use. My need is not
urgent, just curiosity.
On 11/2/20 8:25 AM, Greg Wooledge wrote:
> On Sat, Oct 31, 2020 at 03:42:11PM -0400, Thomas George wrote:
>> I want to assign a unicode character to an unused key on my keyboard. For
>> example F6 currently is assigned ~, name of my home directory. I would like
>> to change it to ♠.
> You are probably confused about what's actually happening. I imagine
> that you opened an X11 terminal window with a shell running in it, and
> pressed F6 without any prelude, and saw a ~ appear in the shell. If
> this is what you did, then you aren't really seeing what F6 does in
> a terminal.
>
>> I have tried xmodmap -e keycode 71 = U2660 and several other variations
>> without success
> As you know, F6 corresponds to a single keycode in X11. All well and
> good.
>
> However, in a *terminal emulator*, that keycode is translated into a
> stream of bytes. And the specific stream of bytes depends on the terminal
> emulator.
>
> Typically, function keys, arrow keys, and the like, will be translated to
> a sequence that begins with ESC [. The effect of this within your shell
> will depend on the shell, and what input/editing mode the shell is
> currently using.
>
> In your case, I imagine that the ESC [ and whatever follows it all get
> swallowed up (they attempt, perhaps, to perform some sort of editing
> manipulation on the empty shell input buffer), and all you see is the
> tilde character. But there are actually several other bytes before
> that. You just aren't seeing them.
>
> The usual hack to see what a key does in a terminal is to press Ctrl-V
> first, and then press the key in question. This relies on the special
> byte of the function key being up front, so that Ctrl-V can escape that
> byte.
>
> In xterm or in urxvt, when I press Ctrl-V F6, I see ^[[17~
>
> The ^[ is a rendering of ESC ("escape"), the first byte of the key's
> translated byte stream. Altogether, F6 sends ESC [ 1 7 ~
> in my terminals.
>
> This matches up with what one would expect from the terminfo database.
>
> unicorn:~$ infocmp xterm | grep f6
> kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
> kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
>
> kf6 ("key function six") is defined as sending \E (ESC) [ 1 7 ~
>
> The terminfo database is what applications use to try to guess what a
> given input sequence of bytes *means*.
>
> If you are trying to map F6 to a specific action within your shell (and
> if that shell is bash), you need to look at readline, ~/.inputrc, the
> bind command, etc.
>
> If on the other hand you'd prefer to do it at the X11 level, then
> look at xmodmap.
>
>
Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread
Special Key Assignment? Thomas George <lists@tomgeorge.info> - 2020-10-31 20:50 +0100
Re: Special Key Assignment? The Wanderer <wanderer@fastmail.fm> - 2020-10-31 21:30 +0100
Re: Special Key Assignment? Linux-Fan <Ma_Sys.ma@web.de> - 2020-10-31 22:30 +0100
Re: Special Key Assignment? Success Thomas George <lists@tomgeorge.info> - 2020-10-31 22:40 +0100
Re: Special Key Assignment? Greg Wooledge <wooledg@eeg.ccf.org> - 2020-11-02 14:30 +0100
Re: Special Key Assignment? Thomas George <lists@tomgeorge.info> - 2020-11-04 20:50 +0100
csiph-web