Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[SOLVED]Changing keyboard layout in console
-
- Posts: 148
- Joined: 2015-01-18 03:40
- Been thanked: 2 times
[SOLVED]Changing keyboard layout in console
Is it possible to have multiply keyboard layouts in console and to have key combination to switch between them?
Last edited by pythagorasmk on 2020-02-13 18:19, edited 1 time in total.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: Changing keyboard layout in console
Not really (AFAIK), but you can use localectl(1) to change console keyboard layout.
Perhaps if you ran dvtm (or plain tmux) from the console you could bind keys calling that command.
EDIT: corrected command name.
Perhaps if you ran dvtm (or plain tmux) from the console you could bind keys calling that command.
EDIT: corrected command name.
Last edited by Head_on_a_Stick on 2020-02-12 17:09, edited 1 time in total.
deadbang
- fabien
- Forum Helper
- Posts: 669
- Joined: 2019-12-03 12:51
- Location: Anarres (Toulouse, France actually)
- Has thanked: 61 times
- Been thanked: 154 times
Re: Changing keyboard layout in console
It is possible to use loadkeys(1) to change keyboard layout on the fly (i.e. without changing system configuration):
- package console-data must be installed
- you have to allow your user to use loadkeys (see https://unix.stackexchange.com/question ... ormal-user)
- there may be security concerns (that's why loadkeys doesn't work if not setuid, see https://git.kernel.org/pub/scm/linux/ke ... c4b8871968) so all in all be aware that it might not be good practice.
- package console-data must be installed
- you have to allow your user to use loadkeys (see https://unix.stackexchange.com/question ... ormal-user)
- there may be security concerns (that's why loadkeys doesn't work if not setuid, see https://git.kernel.org/pub/scm/linux/ke ... c4b8871968) so all in all be aware that it might not be good practice.
-
- Posts: 148
- Joined: 2015-01-18 03:40
- Been thanked: 2 times
Re: Changing keyboard layout in console
I am giving up, security risk + to complicated, not for me. Anyway Thanks for the answer.
-
- Posts: 148
- Joined: 2015-01-18 03:40
- Been thanked: 2 times
Re: Changing keyboard layout in console
I have found package console-setup and with it you can have the same options for keyboard on console, as in Xserver. The default configuration is located in /etc/default/keyboard. Read keyboard(5).fabien wrote:It is possible to use loadkeys(1) to change keyboard layout on the fly (i.e. without changing system configuration):
- fabien
- Forum Helper
- Posts: 669
- Joined: 2019-12-03 12:51
- Location: Anarres (Toulouse, France actually)
- Has thanked: 61 times
- Been thanked: 154 times
Re: [SOLVED]Changing keyboard layout in console
This is the right solution, thanks pythagorasmk. The loadkeys method is definitely to be forgotten then (it was an old remembrance btw, something I used long ago).
Here is the documentation on Debian Wiki: https://wiki.debian.org/Keyboard
is useful to find some configuration elements (layouts, switches) for /etc/default/keyboard.
In short:
- edit /etc/default/keyboard. For example:
this configuration allows to switch between french and US layouts by striking alt and altgr together.
- from the console, test the configuration:
- make changes permanent (this part is not on the Debian Wiki but it is the only way that worked for me):
Here is the documentation on Debian Wiki: https://wiki.debian.org/Keyboard
Code: Select all
man 7 xkeyboard-config
In short:
- edit /etc/default/keyboard. For example:
Code: Select all
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page. man xkeyboard-config(7) also.
XKBMODEL="pc105"
XKBLAYOUT="fr,us"
XKBVARIANT="latin9,"
XKBOPTIONS="grp:alts_toggle"
BACKSPACE="guess"
- from the console, test the configuration:
Code: Select all
setupcon
Code: Select all
dpkg-reconfigure console-setup
-
- Posts: 148
- Joined: 2015-01-18 03:40
- Been thanked: 2 times
Re: [SOLVED]Changing keyboard layout in console
You can edit the file /etc/default/console-setup directly, there is no need for dpkg-reconfigure console-setup. Read console-setup(5).fabien wrote: - make changes permanent (this part is not on the Debian Wiki but it is the only way that worked for me):Code: Select all
dpkg-reconfigure console-setup
The only limitation for me is that accented letters in Macedonian alphabet ( ѐ and ѝ ) and the symbol for euro € are missing in fonts for console.
Also, if you are using Emacs, it is not smart to use left alt + left shift (standard Windows combination ) for switch key, I have assigned this function to ScrollLock.
- fabien
- Forum Helper
- Posts: 669
- Joined: 2019-12-03 12:51
- Location: Anarres (Toulouse, France actually)
- Has thanked: 61 times
- Been thanked: 154 times
Re: [SOLVED]Changing keyboard layout in console
dpkg-reconfigure console-setup is the way I found to make changes permanent, otherwise changes were lost upon reboot (I'm on Buster). Have you done something else to keep changes effective?pythagorasmk wrote:You can edit the file /etc/default/console-setup directly, there is no need for dpkg-reconfigure console-setup. Read console-setup(5).
I know I can edit /etc/default/console-setup directly, I added BEEP="polite" to it to no avail until I run dpkg-reconfigure console-setup. There should be a smarter way though, I agree.
I use alt+altgr in the example above, but that's up to the user (man 7 xkeyboard-config for a list of available switches).pythagorasmk wrote: it is not smart to use left alt + left shift
take a look at section 'Adding currency signs to certain keys' in man 7 xkeyboard-config maybe. For the Macedonian alphabet I have no clue.pythagorasmk wrote:( ѐ and ѝ ) and the symbol for euro € are missing
-
- Posts: 148
- Joined: 2015-01-18 03:40
- Been thanked: 2 times
Re: [SOLVED]Changing keyboard layout in console
For me everything is working fine, I have edited the console-setup with emacs, saved the file, rebooted the system and everything is working fine. I am also on Debian Buster.fabien wrote: dpkg-reconfigure console-setup is the way I found to make changes permanent, otherwise changes were lost upon reboot (I'm on Buster). Have you done something else to keep changes effective?
Yes it is up to the user, but left alt+left shift is useful combination in Emacs.fabien wrote: I use alt+altgr in the example above, but that's up to the user (man 7 xkeyboard-config for a list of available switches).
Yes, I can add the euro sign to some key, but I have to use 3-level chooser, which cannot be pause, scroll lock or prtscr and I don't want to use ctrl or alt for that. I can live with that. It is interesting that I can get euro sign in Xserver with Compose key and after that e and =, but this combination is not working in console, and I don't know why? For macedonian symbols, I think that they are missing in fonts files for console, because the deadkey is working in console. I think that this is a long time bug, and nobody is taking care of it.fabian wrote: take a look at section 'Adding currency signs to certain keys' in man 7 xkeyboard-config maybe. For the Macedonian alphabet I have no clue.
It is interesting that PtrScr is not working as a compose key in console, but it is working in Xserver. I don't know why? I think this is a bug.