Keyboard Mapping in Kubuntu 20.04: Fix Missing Symbols and Broken Keys

Illustrated infographic summarizing: Keyboard Mapping Kubuntu 20.04

By Greg Nowak. Last updated 2026-09-11.

A missing backslash key becomes surprisingly disruptive when you need to edit configuration files or run terminal commands. My original Kubuntu workaround came from using a Danish layout on a Thai keyboard: the physical keyboard lacked the key I needed for backslash. A sticking left Shift key created a second problem, so I reassigned Caps Lock to take its place.

Below is a more complete version of that setup, including how to identify your keys, apply the mapping, undo it, and reload it at login. For a business owner or agency team, the useful outcome is a workstation fix that another person can understand and maintain.

Check your session before changing anything

These commands target X11. Run this in a terminal inside your desktop session:

echo "$XDG_SESSION_TYPE"

If it reports x11, continue below. If it reports wayland, start with Plasma’s keyboard settings. Xwayland provides compatibility for X11 applications within Wayland; an X11 mapping is therefore not a desktop-wide Wayland solution. See the official Xwayland explanation. An empty result needs further checking in your session information.

Also check the operating system’s age. Kubuntu 20.04’s release notes specify support through April 2023. In September 2026, treat this as a legacy workstation fix and plan migration to a supported release.

Situation Recommended approach
Wrong language or symbol positions Check the layout and variant in Plasma’s keyboard settings first.
A few missing symbols on X11 Test a small, documented Xmodmap file.
Broken Shift key on X11 Remap a replacement key and update the modifier map.
Wayland or frequent layout switching Use desktop keyboard options; investigate a suitable XKB configuration if needed.
Choose the method that fits the session and the problem before copying a mapping.

Identify the keys and save a recovery map

Keycodes describe what the system receives, not what is printed on the keycap. The numbers below belong to the original setup; verify yours with:

xev

Focus its event window, press each relevant key, and note the reported keycode. The original values were 49 for the key being repurposed for symbols, 50 for left Shift, and 66 for Caps Lock.

Before applying changes, save the current X11 map. Use a fresh filename if you already have a backup:

xkbcomp "$DISPLAY" "$HOME/.xkbmap-before-remap"

Keep the following recovery command available in an open terminal:

xkbcomp "$HOME/.xkbmap-before-remap" "$DISPLAY"

The xkbcomp manual explains the direction: a display as the source exports its map; a display as the destination receives the map.

Restore access to less-than, greater-than, and backslash

Create or edit $HOME/.Xmodmap in a text editor. Preserve any existing customisations. This is the original symbol mapping:

keycode 49 = less greater backslash backslash backslash

It assigns < and > to the first two positions and backslash to additional positions. Access to those additional symbols depends on the active layout and modifier configuration; do not assume AltGr will behave identically everywhere.

Apply the file using its full path:

xmodmap "$HOME/.Xmodmap"

Test the characters in a text editor before using them in commands. Check the unmodified key, Shift, and your layout’s alternate-level modifier. If backslash remains inaccessible, review the layout’s third-level selector or use an XKB-based adjustment.

Use Caps Lock as a replacement Shift key

If you also have the original hardware problem, add this block after verifying the keycodes:

clear Lock
clear Shift
keycode 50 = NoSymbol NoSymbol NoSymbol NoSymbol NoSymbol
keycode 66 = Shift_L NoSymbol Shift_L NoSymbol Shift_L
add Shift = Shift_L Shift_R

This removes the old Lock and Shift modifier assignments, disables the original left Shift, and rebuilds Shift using the replacement and right Shift. The xmodmap manual documents why modifier keys need these extra steps.

This assumes a conventional modifier setup and deliberately removes Caps Lock behaviour. Inspect existing modifiers with xmodmap -pm if you already have custom mappings. Skip this entire block if your Shift key works.

Reapply the file and test both Shift keys, shortcuts, and ordinary typing. A physically stuck key may still require repair; software remapping is a workaround within this session.

Make the mapping load at login

The original command below remains useful for exporting a working map:

xkbcomp "$DISPLAY" "$HOME/.xkbmap"

Saving this file does not make the mapping persistent. Something must reload your changes after login.

For this small setup, create $HOME/apply-keyboard-map.sh containing:

#!/bin/sh
[ "$XDG_SESSION_TYPE" = "x11" ] || exit 0
exec xmodmap "$HOME/.Xmodmap"

Make it executable:

chmod +x "$HOME/apply-keyboard-map.sh"

Open Autostart in System Settings and add the file as a login script. Labels vary by Plasma version; KDE’s Autostart documentation describes the mechanism. These mapping commands run as your normal desktop user.

Log out and back in, then test again. Also test after switching layouts or reconnecting a keyboard: those actions can replace custom mappings. If the setup repeatedly resets, investigate the keyboard configuration rather than adding arbitrary startup delays.

Leave a fix someone else can support

Record the keyboard model, layout, session type, changed keys, and recovery command. To undo this setup, remove its Autostart entry and restore the saved map. Remember that a desktop login script does not configure the pre-login screen.

If recurring workstation issues are interrupting delivery, talk to Greg about your setup. Bring the symptoms and current workaround so we can discuss a maintainable fix and a clear handover for your team.

Related on GrN.dk

Need help with this kind of work?

Talk to Greg about your technical setup Get in touch with Greg.

Sources

Seneste artikler

Samme kunde på flere kort i HubSpot? Se, hvordan CVR-match, AI-forslag og menneskelig godkendelse kan bruges til at rydde op med styr på felter, relationer og kundehistorik.

Få en ugentlig marketingrapport fra GA4 og Google Ads med kontrollerede beregninger, tydelige dataforbehold og et kort AI-udkast, der hjælper jer på mandagsmødet.

Brug AI til webshoppens alt-tekster med en overskuelig pilot: kortlæg billederne, få danske forslag, og kontrollér resultatet i WordPress og WooCommerce.

AI-baseret ticketanalyse kan afsløre gentagne klager, produktfejl og huller i dokumentationen – uden at virksomheden behøver endnu en chatbot.

OpenSSH 10 fjerner DSA og advarer om nøgleudveksling, der ikke er post-kvantesikker. Her får du en metode til at afgrænse SFTP-oprydningen uden at svække alle SSH-forbindelser.

Botforespørgsler overstiger nu menneskelig webtrafik. Lær at auditere AI-crawlere, fastsætte regler på stiniveau, håndhæve robots.txt og måle det forretningsmæssige afkast.

Cloudflares Tunnel-opdateringer fra 2026 forbedrer kortlægning, overvågning af replikaer, logstreaming og overdragelse – men synliggør samtidig svagt ejerskab og mangelfuld praksis for failover og logging.

Sådan bruger du AI til mødenoter og opfølgning, mens faste regler beskytter CRM-data, kundematch og pipeline mod fejl og forhastede ændringer.

Drupal 10 når end of life den 9. december 2026. Brug denne praktiske kortlægning til at afgrænse arbejdet med Drupal 11-parathed, Composer-efterslæb, moduler og custom code.

Apache 2.4.67 tydeliggjorde risikoen ved overtagne reverse proxies. Læs, hvordan du opgraderer til 2.4.68, gennemgår HTTP/2, AJP og .htaccess og tester ændringerne sikkert.