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

Latest articles

When WordPress jobs run late, check WP-Cron and queue capacity first. Diagnose triggers, handlers, and Action Scheduler without guesswork.

WordPress 7.1 makes speculative loading configurable. Here’s how to spot overlapping rules and test speed gains without adding hidden costs.

Multiple records for the same customer in HubSpot? Learn how CVR number matching, AI suggestions and human approval can help you clean up duplicates while keeping track of fields, associations and customer history.

Before a Google AI shopping pilot, check which products qualify, where your catalog data disagrees, and whether checkout reflects your delivery and return terms.

Check whether prompt caching reduces cost per completed task, accounting for cache writes, retries, review effort and the charges on your provider's bill.

A practical Drupal translation workflow for Danish service pages: German review, commercial approval, publication and keeping translations current after edits.

Build a weekly marketing report from GA4 and Google Ads with verified calculations, clear data caveats and a short AI draft to support your Monday meeting.

Before buying a GPU, test one real team workflow on existing hardware. A Linux pilot can show whether quality, memory, response times, and running costs add up.

Planning a Drupal relaunch? Set clear rules for content, translations, media and old URLs, with a practical checklist for approving the migration and launch.

Use AI for your online store’s alt text with a manageable pilot: map the images, generate suggestions in Danish, and check the results in WordPress and WooCommerce.