Differences between revisions 2 and 61 (spanning 59 versions)
Revision 2 as of 2008-02-04 14:49:00
Size: 1164
Comment: typo
Revision 61 as of 2022-05-22 07:15:56
Size: 10106
Editor: PaulWise
Comment: minor cleanup
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
## ##############################################################
##
## More informations on "DebianWiki/EditorGuide" article
## Don't use all this template, just what you need !
##
## ##############################################################
##
||<tablestyle="width: 100%;" style="border: 0px hidden">~-Translation(s): none-~ ||<style="text-align: right; border: 0px hidden"> (!) [:/Discussion:Discussion]||
[[BR]]
||<tablestyle="width: 100%; text-align: center; border: 0px hidden"> http://www.debian.org/logos/openlogo-nd-50.png http://www.debian.org/Pics/debian.png||
||<style="border: 0px hidden">~+inline:Portal/IDB/logo_portal.png Welcome to ["Debian"] Keyboard+~||
##For Translators - to have a constantly up to date translation header in you page, you can just add a line like the following
## <<Include(Keyboard, ,from="^##TAG:TRANSLATION-HEADER-START",to="^##TAG:TRANSLATION-HEADER-END")>>
##TAG:TRANSLATION-HEADER-START
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: [[Keyboard|English]] - [[fr/Keyboard|Français]] - [[it/Keyboard|Italiano]] - [[pt_BR/Keyboard|Português (Brasil)]] - [[ru/Keyboard|Русский]]-~
##TAG:TRANSLATION-HEADER-END
Line 14: Line 8:
inline:Portal/IDB/icon-template-32x32.png This portal talk about keyboards. Technical language could be used, but explained. {{attachment:Portal/IDB/icon-wiki-portal.png}}

[[FrontPage|Debian wiki]] keyboard portal. This portal covers all aspects of configuring keyboards on Debian.

<<TableOfContents(3)>>

See [[https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_keyboard_input|"The keyboard input" in debian-reference]], too.

== Basic keyboard configuration ==

To configure the keyboard, you have to install DebianPkg:keyboard-configuration. The package DebianPkg:console-setup is also needed.

The keyboard settings are stored in '''{{{/etc/default/keyboard}}}''' file provided by the DebPkg:keyboard-configuration package. Other packages use this to configure both the Linux kernel and the X Window system to realize consistent keyboard experiences under the Linux console and the X Window system.

You can change your keyboard settings using:
{{{
 # dpkg-reconfigure keyboard-configuration
 # service keyboard-setup restart
}}}

As usual, it will prompt you for the ''model'' of keyboard (what the keyboard ''*is*''), and then for the keyboard ''layout'' (what the keys should ''*do*''). Use this tool to change your keyboard map, e. g. from ''QWERTY'' to ''QWERTZ'' or to ''Dvorak'', or for non-English layouts.

To apply new settings, restarting the {{{keyboard-setup}}} service should suffice, otherwise you can try to restart kernel input system via udev:

{{{
 # udevadm trigger --subsystem-match=input --action=change
}}}
or '''reboot''' the whole OS.

== Modern keyboard configuration (input method) ==

The simple keyboard input mechanism realized by the above configuration can't support some languages, such as Chinese and Japanese, properly.

The installation of the input method framework package such as DebianPkg:ibus (or DebianPkg:fcitx5) together with associated packages enables to support all languages.

When any of the input method framework packages are installed and activated, the X Window based keyboard configuration settings are ignored.

For GNOME system (the default Debian Desktop environment), DebianPkg:ibus package is automatically installed and activated. The keyboard input needs to be configured from its GUI '''{{{Settings -> Keyboard}}}''' for basic configurations. For more complicated configuration such as swapping '''{{{CapsLock}}}''' and '''{{{Ctrl}}}''', you need to install DebianPkg:gnome-tweak and use it.

For non-GNOME system, the stand alone GUI configuration command '''{{{ibus-setup}}}''' can set up the input methods for DebianPkg:ibus. Under those desktop environments, menu entry of their keyboard configuration utility or pop-up menu entry offered by clicking the associated tray icon may start '''{{{ibus-setup}}}''' for you. For KDE, this menu is '''{{{System_settings -> Hardware -> Input_devices/keyboard}}}'''.

== Multi-language keyboard configuration strategy ==

People who wish to set up a single keyboard input environment for multiple (European) languages without the input method framework should consider following configuration strategy.

 * If the input method package is installed, deactivate it by executing '''{{{im-config -n none}}}'''.
 * Select the correct keyboard model. (US/ISO)
 * Select the desirable keyboard layout. E.g., English (US International AltGr Unicode combining,alternative)

People who wish to set up multiple dynamically-switchable keyboard input environments for multiple languages should consider following configuration strategy.

 * Install input method framework package such as DebianPkg:ibus
 * (optional) Install pertinent input method engine package such as DebianPkg:ibus-anthy
 * Activate desirable input engine by adding it from menu such as '''{{{Settings -> Keyboard --> Input Sources}}}'''.
 * Switch among input methods with by pressing '''{{{GUI-SPACE}}}'''.

Please note that the input method framework such as DebianPkg:ibus provides functionality to enter many Unicode characters for European languages without additional engine packages after the proper GUI based configuration.

== Keyboard configuration Tips ==

=== Manual configuration of keyboard ===

You can edit {{{/etc/default/keyboard}}} manually instead of running '''{{{dpkg-reconfigure keyboard-configuration}}}'''.

Here's an example:
{{{
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us,de,fr,ua,ru"
XKBVARIANT=""
XKBOPTIONS="grp:alt_shift_toggle"

BACKSPACE="guess"
}}}

 * XKBMODEL is a keyboard model variable (look at a {{{/usr/share/X11/xkb/rules/base.lst}}} (plain text) or {{{/usr/share/X11/xkb/rules/base.xml}}} (XML) for a full list);
 * XKBLAYOUT variable contains a list of used layouts;
 * "grp:alt_shift_toggle" sets a layout switching key combination (<Alt>+<Shift>).

Under the X environment, this keyboard layout setting in {{{/etc/default/keyboard}}} can be overridden by executing something like "{{{setxkbmap us,ru -option grp:ctrl_shift_toggle}}}" in the X startup configuration file {{{~/.xsessionrc}}} . Please note that this is effective only for the X environment and the modern GUI environment may not be running under X environment.

See also:
 * [[DebianMan:5/keyboard|keyboard(5)]] man page.
 * [[/MultimediaKeys|Configure additional multimedia keys]].

=== How to set keyboard layout in initramfs ===

The appropriate section of {{{/etc/initramfs-tools/initramfs.conf}}} needs to be changed to have a localized keyboard layout at boot time:
{{{
#
# KEYMAP: [ y | n ]
#
# Load a keymap during the initramfs stage.
#

KEYMAP=y
}}}

Apply changes:
{{{
 # update-initramfs -u
}}}

=== How to enable USB keyboard in initramfs ===

The initramfs-tools must include the {{{usbhid}}} module and its dependencies for USB keyboard support at boot time. Either the configuration file {{{/etc/initramfs-tools/conf.d/driver-policy}}} must include most modules, or they will have to be specified in another file:
{{{
#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list
#

MODULES=most
}}}

If the configuration above was not set to include most modules, then the necessary modules have to be specified in the file {{{/etc/initramfs-tools/modules}}}:
{{{
# USB keyboard at boot
usbcore
uhci_hcd
ehci_hcd
usbhid
}}}

Apply changes:
{{{
 # update-initramfs -u
}}}

=== How to dynamically activate Linux console settings ===

In order to activate changed settings in {{{/etc/default/keyboard}}} without reboot, run [[DebianMan:1/setupcon|setupcon(1)]].

=== How to dynamically activate X Window settings ===

If the input method framework is not active, you can switch the keyboard layout of X Window system from the terminal, e. g.:
{{{
 $ setxkbmap de
 $ setxkbmap fr
 $ setxkbmap us
}}}

Of special interest for keyboard hardware with us layout might be the ''altgr-intl'' variant (this provides a simple !AltGr mapping for many umlauts and special symbols):
{{{
 $ setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl
}}}
or
{{{
 $ setxkbmap -model pc105 -layout us -variant altgr-intl
}}}

To configure a simple key for toggling between multiple configured keyboard layouts, see Option !XkbOptions in Section !InputClass somewhere within the xorg config file collection (see [[https://forums.freebsd.org/threads/solved-setxkbmap-xinitrc.48412/#post-270733|[SOLVED] Setxkbmap .xinitrc]]).

=== How to dynamically manage GNOME input source settings ===

For GNOME, you can check the current input source setting from the command line using:
{{{
 $ gsettings get org.gnome.desktop.input-sources xkb-options
}}}

For GNOME, you can reset it from the command line, if necessary, using:
{{{
 $ gsettings reset org.gnome.desktop.input-sources xkb-options
}}}

For GNOME, you can create a custom keyboard shortcut to select a particular input source by assigning command to '''{{{Settings -> Keyboard -> Keyboard Shortcuts}}}'''. E.g. the following will select the first input source:

{{{
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().inputSources[1].activate()"
}}}


== Troubleshooting ==

=== very old GNOME (currently not an issue@2022) ===

The keyboard layout was changed on '''{{{Settings -> Region & Languages -> Input Sources}}}'''). For releases older than Stretch (initially released @2018), these layouts include minority languages and dialects, as well as very specific configurations, and were hidden by default in the GUI for Stretch (during its testng?).

One can set it via CLI using dconf/gsettings by adding keys to '''{{{/org/gnome/desktop/input-sources/sources}}}'''.

The only way to make them visible is to enable the corresponding setting in gconf:
{{{
 $ gsettings set org.gnome.desktop.input-sources show-all-sources true
}}}

For more information on this issue see [[https://bugzilla.gnome.org/show_bug.cgi?id=682240]].


=== kitty terminal and input method ===

GPU based terminal emulator DebianPkg:kitty doesn't use X, GTK, nor QT library. In order to activate input method to enter some characters for Chinese or Japanese, you need to follow {{{/usr/share/doc/kitty/README.Debian}}}.
Line 16: Line 211:

## For long portal, you can use a TOC
## [[TableOfContents(2)]]

 * [:/MultimediaKeys:Configure additional multimedia key]

## == Waiting for rectification ==
## Pages need works like merging, ambiguous

----
## - If this page belongs to an existing Category, add it below.
 CategoryPortal | CategoryKeyboard
CategoryPortal | CategoryHardware

Translation(s): English - Français - Italiano - Português (Brasil) - Русский


Portal/IDB/icon-wiki-portal.png

Debian wiki keyboard portal. This portal covers all aspects of configuring keyboards on Debian.

See "The keyboard input" in debian-reference, too.

Basic keyboard configuration

To configure the keyboard, you have to install keyboard-configuration. The package console-setup is also needed.

The keyboard settings are stored in /etc/default/keyboard file provided by the keyboard-configuration package. Other packages use this to configure both the Linux kernel and the X Window system to realize consistent keyboard experiences under the Linux console and the X Window system.

You can change your keyboard settings using:

 # dpkg-reconfigure keyboard-configuration
 # service keyboard-setup restart

As usual, it will prompt you for the model of keyboard (what the keyboard *is*), and then for the keyboard layout (what the keys should *do*). Use this tool to change your keyboard map, e. g. from QWERTY to QWERTZ or to Dvorak, or for non-English layouts.

To apply new settings, restarting the keyboard-setup service should suffice, otherwise you can try to restart kernel input system via udev:

 # udevadm trigger --subsystem-match=input --action=change

or reboot the whole OS.

Modern keyboard configuration (input method)

The simple keyboard input mechanism realized by the above configuration can't support some languages, such as Chinese and Japanese, properly.

The installation of the input method framework package such as ibus (or fcitx5) together with associated packages enables to support all languages.

When any of the input method framework packages are installed and activated, the X Window based keyboard configuration settings are ignored.

For GNOME system (the default Debian Desktop environment), ibus package is automatically installed and activated. The keyboard input needs to be configured from its GUI Settings -> Keyboard for basic configurations. For more complicated configuration such as swapping CapsLock and Ctrl, you need to install gnome-tweak and use it.

For non-GNOME system, the stand alone GUI configuration command ibus-setup can set up the input methods for ibus. Under those desktop environments, menu entry of their keyboard configuration utility or pop-up menu entry offered by clicking the associated tray icon may start ibus-setup for you. For KDE, this menu is System_settings -> Hardware -> Input_devices/keyboard.

Multi-language keyboard configuration strategy

People who wish to set up a single keyboard input environment for multiple (European) languages without the input method framework should consider following configuration strategy.

  • If the input method package is installed, deactivate it by executing im-config -n none.

  • Select the correct keyboard model. (US/ISO)
  • Select the desirable keyboard layout. E.g., English (US International ?AltGr Unicode combining,alternative)

People who wish to set up multiple dynamically-switchable keyboard input environments for multiple languages should consider following configuration strategy.

  • Install input method framework package such as ibus

  • (optional) Install pertinent input method engine package such as ibus-anthy

  • Activate desirable input engine by adding it from menu such as Settings -> Keyboard --> Input Sources.

  • Switch among input methods with by pressing GUI-SPACE.

Please note that the input method framework such as ibus provides functionality to enter many Unicode characters for European languages without additional engine packages after the proper GUI based configuration.

Keyboard configuration Tips

Manual configuration of keyboard

You can edit /etc/default/keyboard manually instead of running dpkg-reconfigure keyboard-configuration.

Here's an example:

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us,de,fr,ua,ru"
XKBVARIANT=""
XKBOPTIONS="grp:alt_shift_toggle"

BACKSPACE="guess"
  • XKBMODEL is a keyboard model variable (look at a /usr/share/X11/xkb/rules/base.lst (plain text) or /usr/share/X11/xkb/rules/base.xml (XML) for a full list);

  • XKBLAYOUT variable contains a list of used layouts;
  • "grp:alt_shift_toggle" sets a layout switching key combination (<Alt>+<Shift>).

Under the X environment, this keyboard layout setting in /etc/default/keyboard can be overridden by executing something like "setxkbmap us,ru -option grp:ctrl_shift_toggle" in the X startup configuration file ~/.xsessionrc . Please note that this is effective only for the X environment and the modern GUI environment may not be running under X environment.

See also:

How to set keyboard layout in initramfs

The appropriate section of /etc/initramfs-tools/initramfs.conf needs to be changed to have a localized keyboard layout at boot time:

#
# KEYMAP: [ y | n ]
#
# Load a keymap during the initramfs stage.
#

KEYMAP=y

Apply changes:

 # update-initramfs -u

How to enable USB keyboard in initramfs

The initramfs-tools must include the usbhid module and its dependencies for USB keyboard support at boot time. Either the configuration file /etc/initramfs-tools/conf.d/driver-policy must include most modules, or they will have to be specified in another file:

#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list
#

MODULES=most

If the configuration above was not set to include most modules, then the necessary modules have to be specified in the file /etc/initramfs-tools/modules:

# USB keyboard at boot
usbcore
uhci_hcd
ehci_hcd
usbhid

Apply changes:

 # update-initramfs -u

How to dynamically activate Linux console settings

In order to activate changed settings in /etc/default/keyboard without reboot, run setupcon(1).

How to dynamically activate X Window settings

If the input method framework is not active, you can switch the keyboard layout of X Window system from the terminal, e. g.:

 $ setxkbmap de
 $ setxkbmap fr
 $ setxkbmap us

Of special interest for keyboard hardware with us layout might be the altgr-intl variant (this provides a simple AltGr mapping for many umlauts and special symbols):

 $ setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl

or

 $ setxkbmap -model pc105 -layout us -variant altgr-intl

To configure a simple key for toggling between multiple configured keyboard layouts, see Option XkbOptions in Section InputClass somewhere within the xorg config file collection (see [SOLVED] Setxkbmap .xinitrc).

How to dynamically manage GNOME input source settings

For GNOME, you can check the current input source setting from the command line using:

 $ gsettings get org.gnome.desktop.input-sources xkb-options

For GNOME, you can reset it from the command line, if necessary, using:

 $ gsettings reset org.gnome.desktop.input-sources xkb-options

For GNOME, you can create a custom keyboard shortcut to select a particular input source by assigning command to Settings -> Keyboard -> Keyboard Shortcuts. E.g. the following will select the first input source:

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval  "imports.ui.status.keyboard.getInputSourceManager().inputSources[1].activate()"

Troubleshooting

very old GNOME (currently not an issue@2022)

The keyboard layout was changed on Settings -> Region & Languages -> Input Sources). For releases older than Stretch (initially released @2018), these layouts include minority languages and dialects, as well as very specific configurations, and were hidden by default in the GUI for Stretch (during its testng?).

One can set it via CLI using dconf/gsettings by adding keys to /org/gnome/desktop/input-sources/sources.

The only way to make them visible is to enable the corresponding setting in gconf:

 $ gsettings set org.gnome.desktop.input-sources show-all-sources true

For more information on this issue see https://bugzilla.gnome.org/show_bug.cgi?id=682240.

kitty terminal and input method

GPU based terminal emulator kitty doesn't use X, GTK, nor QT library. In order to activate input method to enter some characters for Chinese or Japanese, you need to follow /usr/share/doc/kitty/README.Debian.


CategoryPortal | CategoryHardware