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 ?
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:
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.
6The installation uses a graphical setup to detect the layout.
dpkg-reconfigureis not a graphical setup. Dec 31, 2014 at 8:27
2Many upvotes, but not the answer to the question asked: a tool that autodetects a layout– vanadiumDec 24, 2021 at 13:40
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.
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. May 8, 2021 at 17:54
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.
10yes, 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. Dec 2, 2013 at 13:03
2Did you ever find out how to discover your keyboard layout?– MagickSep 8, 2017 at 16:56