Now that Unity is gone, the usual way of setting a Compose Key (via Keyboard Preferences > Layout) no longer works (because in Ubuntu 18.04, Devices > Keyboard has no Layout tab).
How do we set a Compose Key in Ubuntu 18.04 Bionic Beaver?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
You may use (GNOME) Tweaks to set the option.
First install Tweaks by running
sudo apt install gnome-tweaks
sudo apt install gnome-tweak-tool).
Alternatively, for those who prefer the GUI:
launch the Ubuntu Software application.
search for "gnome tweaks".
Then launch Tweaks and go to "Keyboard & Mouse" section. The "Compose Key" options is disabled by default. Click on the "Disabled" button.
Then a window will pop up. Toggle the switch at the top on and then you'll be select the compose key
To expand upon what @pomsky detailed in their answer, the official documentation covers the two solutions available.
One is through installing Gnome Tweak Tool via the terminal like so:
sudo apt install gnome-tweak-tool
And the other is typing the Unicode character's code point. To do this, press Ctrl+Shift+U, release all keys (you'll see an underlined
u), type the code point desired, and then press Space or Enter to complete.
For example, a common one I use is referred to as “Smart Quotes” which are U+201C & U+201D respectively. So you would type 201C or 201D after releasing the initial keys, and complete the process with Space or Enter.
The dconf setting that worked for my GNOME 3.28.2 is
To set the Scroll Lock as the compose key, the value should be
See the gnome-tweaks source code for other potential values.
That means you can run a command like this:
dconf write /org/gnome/desktop/input-sources/xkb-options "['compose:sclk']"
man xkeyboard-config and look for the compose options (shortcut: enter
You will find
compose:ralt Right Alt compose:lwin Left Win compose:lwin-altgr 3rd level of Left Win compose:rwin Right Win compose:rwin-altgr 3rd level of Right Win compose:menu Menu compose:menu-altgr 3rd level of Menu compose:lctrl Left Ctrl compose:lctrl-altgr 3rd level of Left Ctrl compose:rctrl Right Ctrl compose:rctrl-altgr 3rd level of Right Ctrl compose:caps Caps Lock compose:caps-altgr 3rd level of Caps Lock compose:102 <Less/Greater> compose:102-altgr 3rd level of <Less/Greater> compose:paus Pause compose:prsc PrtSc compose:sclk Scroll Lock
Let us say you want to pick Pause as the compose key. Just issue
setxkbmap -option compose:paus
To make it reboot-persistent, open
/etc/default/keyboard with your favorite editor.
sudo nano /etc/default/keyboard
and to the line
compose:paus. If you had other options already,
separate them with commas. For example:
Multiple compose keys can be used simultaneously.