29

What's the name of the program used to detect keyboards layout during ubuntu installation ? Is there another tool I can run after installation in other to discover the correct layout for a keyboard I bought ?

3 Answers 3

16

This tool will show your current layout graphically:

gkbd-keyboard-display -g 1

This is the command used during setup for choosing your keyboard layout:

dpkg-reconfigure keyboard-configuration

But to make it auto-detect the keyboard, you need to change a setting in dpkg-reconfigure keyboard-configuration. I'm not sure what setting, though.

To change a setting, echo <packagename> <setting> <type> <value> | debconf-set-selections. For example:

echo "keyboard-configuration console-setup/ask_detect boolean true" | debconf-set-selections

Hopefully this helps you.

2
  • 7
    The installation uses a graphical setup to detect the layout. dpkg-reconfigure is not a graphical setup. Commented Dec 31, 2014 at 8:27
  • 2
    Many upvotes, but not the answer to the question asked: a tool that autodetects a layout
    – vanadium
    Commented Dec 24, 2021 at 13:40
5

The program used to detect keyboard layout during Ubuntu installation is part of the ubuntu installer called "Ubiquity".

You can find the source code on the Launchpad project page or download the release used in your Ubuntu version using

apt-get source ubiquity

You can navigate in the code here: https://git.launchpad.net/ubuntu/+source/ubiquity/tree/?h=ubuntu/bionic-devel

The GTK GUI definition with the button "Detect Keyboard Layout" is here: https://git.launchpad.net/ubuntu/+source/ubiquity/tree/gui/gtk/stepKeyboardConf.ui Search for 'Detect Keyboard Layout', you will find 'deduce_layout'

I'm not 100% sure but I think the code that does the keyboard detection is here: https://git.launchpad.net/ubuntu/+source/ubiquity/tree/ubiquity/plugins/ubi-console-setup.py Search for 'deduce_layout', you will find 'calculate_keymap_button' (calculate_clicked), etc.

And here: https://git.launchpad.net/ubuntu/+source/ubiquity/tree/ubiquity/frontend/gtk_components/keyboard_query.py Search for 'ubiquity/text/keyboard_query_title'.

See also this webpage for easier navigation in the code: http://nullege.com/codes/search/ubiquity.keyboard_detector.KeyboardDetector

I hope it helps.

1
  • 1
    For future reference, the decision tree that's used for that keyboard layout tool is stored in /usr/share/console-setup/pc105.tree. The source is from the debian console-setup package and it's generated by this script. Commented May 8, 2021 at 17:54
0

Install the console-data package.

sudo apt-get install console-data

Then run this command on the terminal:

sudo dpkg-reconfigure console-data

It will then allow you to change the keyboard layout.

2
  • 10
    yes, but what I want is to discover, what is my layout. I know how to change it, once I discover. The problem is that my new keyboard has some keys in non-standard places that aren't being recognized by the so. Commented Dec 2, 2013 at 13:03
  • 2
    Did you ever find out how to discover your keyboard layout?
    – Magick
    Commented Sep 8, 2017 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .