There are at several distinct ways of getting accented characters and
other non-ASCII symbols in Linux. Confusingly, many of them seem to be
called called "compose sequences" and none is apparently well-known.
Note that I'm talking here about the British keyboard layout; US etc.
works the same way but has different mappings. I'm also assuming
you're in a Unicode locale.
The first method is the "UK-extended" keyboard layout, standard on
modern Linux and largely documented for ChromeOS
here but not
exactly the same as shown there; I haven't seen a canonical list
specifically for non-Android Linux. One uses AltGr to modify another
key either to generate a character in itself, or to generate a "dead
key" code, which doesn't produce a character itself but modifies what
comes next. So for example
AltGr m produces µ.
AltGr ' appears to do nothing, but followed by e produces ê.
Shift AltGr ' followed by S produces Š.
(And if you get all the presses and releases for that last one right
the first time, from memory, you type that more often than I do, and I
own a Škoda.)
The other method is the libX11 compose system, lightly documented at
compose(5). (This probably won't work if you're on Wayland, but nor
will lots of other things.) This is readily configurable, but more
importantly the configuration file is human-readable. Details of how
to find it are in that man page, but mine is at
/usr/share/X11/locale/en_US.UTF-8/Compose and includes lines like
<Multi_key> <minus> <minus> <period> : "–" U2013 # EN DASH
<Multi_key> <minus> <minus> <minus> : "—" U2014 # EM DASH
But what is <Multi_key>? That is the "compose key", and you will
need to choose a key that you're not using for anything else to
dedicate to it. Some people use a spare Control key, some the
pointless Windows or Menu keys, but I have chosen caps lock since I
almost never want to type a long series of capital letters and this
prevents me from doing so by accident.
So in my .xsession, to be run when I start a new graphical session,
I have
setxkbmap -option compose:caps
(the setxkbmap command is in the x11-xkb-utils package which may
already be installed).
Then I can type [capslock] [minus] [minus] [minus] and produce —.
Those two should work pretty much everywhere (well, not through
Virtualbox into Windows). There are also more specific means:
-
The GTk graphical toolkit library offers hex code entry to programs
using it (so if you want to enter my favourite Unicode character,
CYRILLIC LETTER MULTIOCULAR O, you need to know it's code A66E). For
that: hold ctrl-shift, tap u, type the hex code, release ctrl-shift.
This will work in many modern graphical applications such as web
browsers. In some cases (such as desktop Signal, which uses
Electron), it's ctrl-shift, tap u, release ctrl-shift, hex code,
return.
-
Emacs of course does its own thing. Ctrl-x 8 [return] (hex code) [return]. This will also allow character names, and even supports
tab completion.
-
urxvt (my preferred terminal) supports ctrl-shift, hex code, release
ctrl-shift.
And probably more that I haven't discovered!