Linux mint keyboard config

Linux Mint Forums

General guidance on setting keymaps, layouts, and variants

Forum rules
Don’t add support questions to tutorials please; start your own topic in the appropriate sub-forum instead. Before you post please read forum rules

General guidance on setting keymaps, layouts, and variants

Post by cypherdtraitor » Mon Mar 22, 2021 9:37 am

TLDR: If you can’t get keyboard settings to work, try making an «startup application» with a 5 second delay that calls `setxkbmap`

disclaimer: I’m actually using debian 10 bullseye, but Linux Mint seems to be the de-facto forum for cinnamon DE related stuff, so I’m posting here.

If you need to set up multiple keyboard layouts or keyboard variants, you should first try to do so through settings. If you can make that work, your life will be much easier.

There are some use cases that are not supported by Cinnamon settings. For example, I use a custom US keyboard variant layout I call «chromebook» which cannot be selected or activated correctly through the keyboards settings. I use altgr (right alt) to switch between US variants, and this is also not supported in keyboard settings.

If you have exhausted all of your options in the keyboard settings menu, you will quickly hit some unusual behaviour. Here is a high-level overview of what is happening:

Most Linux distributions build their keyboard settings using a toolset called «XKB». XKB is somewhat poorly documented, but basically you have the following files:

/usr/share/X11/xkb #directory containing layouts, keymappings, and rules. I add my variants to ./symbols/us
/etc/default/keyboard #this is a simplified file that XKB loads on bootup to specify what layouts, variants, and options to use

As an example, here is my /etc/default/keyboard file:

```/etc/default/keyboard``` # KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="pc105" XKBLAYOUT="us,us" XKBVARIANT="chromebook, chromebook_overlay" XKBOPTIONS=",grp:switch" BACKSPACE="guess" ```

dconf / gsettings

Starting with the release of Gnome3, the Gnome team wanted to control keyboard configuration through their dconf system, which is sort of like a windows registry for Gnome. These settings override XKB during DE startup!

Cinnamon inherits this behaviour. Many of the gnome settings are duplicated with cinnamon settings. I have not found documentation for this, so I simply dug through until I found them all:

org.cinnamon.desktop.input-sources sources org.cinnamon.desktop.input-sources xkb-options org.gnome.desktop.input-sources sources org.gnome.desktop.input-sources xkb-options org.gnome.libgnomekbd.keyboard layouts org.gnome.libgnomekbd.keyboard options

After many hours of trial and error, I was unable to recreate the behaviour I used to get with /etc/default/keyboard

A Simple Workaround

Cinnamon supports an «startup applications» feature available through the standard menu. These applications run as the user who is logging in, so these can’t require root permissions.

Читайте также:  Smb1 disabled no workgroup available linux

Fortunately, XKB has a command called `setxkbmap` which can be used without root permissions to set the keyboard map for the current user. I created a custom startup application with the following options:

Name: fix-keyboard Command: setxkbmap -layout "us,us" -variant "chromebook,chromebook_overlay" -option "" -option "grp:switch" Startup Delay: 5s Comment: fixes my keyboard

Now, every time my computer boots:
1. XKB sets my keyboard one way
2. Cinnamon sets my keyboard a different way
3. The autostart script sets my keyboard the right way

I’m not going to win prizes for boot speed, but it does work.

A better Workaround?

There should be a way to drop a .desktop file in /etc/xdg/autostart such that each user gets the setxkbmap command automatically. I experimented with that but was unsuccessful. If you can figure it out, please add that in the comments below.

Re: General guidance on setting keymaps, layouts, and variants

Post by Tanjiro » Wed Feb 02, 2022 11:45 am

Hi, I am not sure this is related, but just in case, as you don’t mention the evdev.xml and evdev.lst files.

To make my custom keyboard layout work, I had to do 3 things:
— create a variant in xkb/symbols/xx file (replace xx by the target language)
— add the variant in xkb/rules/evdev.xml file
— add the variant in the xkb/rules/evdev.lst file

When doing this, and select my custom keyboard in settings, Mint/Cinnamon remembers the settings after reboot.
I am on Mint 20.3.

Drugwash Level 5
Posts: 689 Joined: Fri Jun 07, 2019 6:40 am Location: Ploieşti, RO Contact:

Re: General guidance on setting keymaps, layouts, and variants

Post by Drugwash » Wed Feb 02, 2022 1:52 pm

Tanjiro wrote: ⤴ Wed Feb 02, 2022 11:45 am To make my custom keyboard layout work, I had to do 3 things:

Yep, same here and it’s been working fine for two years already in Mint 19.2 Cinnamon.
They say there would be an additional command to input once in Terminal in order to update the layouts list:
for GNOME 3.8+
gsettings set org.gnome.desktop.input-sources show-all-sources true
or GNOME 3/Unity
gsettings set org.gnome.libgnomekbd.desktop load-extra-items true
or GNOME 2
gconftool-2 -t bool -s /desktop/gnome/peripherals/keyboard/general/loadExtraItems true
Not sure which one pertains to Mint, I tried them all back then.

There also used to be a tool called Keyboard Layout Editor that could allegedly edit any layout but when I tested it it had some annoying bugs so ended up editing the layout file manually.

Источник

Linux Mint Forums

Good way to configure or edit keyboard layout?

Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

Читайте также:  Oracle linux with oracle xe

Good way to configure or edit keyboard layout?

Post by Dirkoir » Tue Sep 23, 2014 10:46 pm

I often have to write foreign or mixed language texts, and will probably need to make my own custom keyboard layout or key bindings to get an optimum configuration.

  1. Keyboard layout with dead keys : In that case if you type the » symbol, nothing appears until you press another key and then the two get combined if possible (e.g. ä).
  2. Compose key : In that case you need to configure a compose key in your keyboard layout’s options. The compose key followed by (or — if you are acrobatic enough — pressed together with the » symbol (shift-‘)) will then let you type another key like «a» and the two get combined if possible (ä).
  3. A foreign language layout which pretends my US keyboard is actually a foreign one (e.g. a German one where the Y and Z keys are swapped and umlauts sit on keys which on the UU keyboard have brackets and such)
  • alt-A = ä
  • alt-shift-A = Ä
  • alt-O = ö
  • alt-shift-O = Ö
  • alt-U = ü
  • alt-shift-U = Ü
  • alt-S = ß

Reading xkb specs has left my brain in twists and knots and made me wonder if xkb even accommodates the use of ctrl-alt as modifier. If xkb does accommodate, figuring out a way to do this manually inside a modified /usr/share/X11/xkb/symbols/ys may be akin to felling the entire Amazon forest in order to connect two neighbouring villages with a road. Yikes! The only GUI tool I have found so far xkeycaps is likewise not very intuitive and still presents me with the xkb «no alt key» conundrum. I tried key bindings via System Settings > Keyboard > Keyboard Shortcuts, but these shortcuts only fire off system commands and I don’t know of one which would simulate keystrokes.

Does anyone have any ideas?

______
Engineer’s motto: Warum einfach wenn’s auch kompliziert geht?

Re: Good way to configure or edit keyboard layout?

Post by expat_tony » Wed Sep 24, 2014 4:05 pm

Looks like nobody has any better ideas. No time-savers anyway.
If I were using more of those symbols than I do, but didn’t want to use dead keys, I’d go to Settings > Keyboard and grab a screenshot of the Preview pop-up of English (US), International with dead keys (the most comprehensive choice I found), I’d print it and use it to configure my own board as you’re thinking of doing. You can keep the preview as a cheat sheet while you’re learning, easy to write over it too if you make alterations.

Re: Good way to configure or edit keyboard layout?

Post by Shunjoss » Wed Sep 24, 2014 4:17 pm

if you have a good memory and don’t need to look at your keyboard to type. You just can take the «native» keyboard-layout for each language.
The best suited could be to have them all in a qwerty derivative, to avoid to learn different layout. And change when needed.

Читайте также:  Linux ubuntu установка настройка

Workaround: Good way to configure or edit keyboard layout?

Post by Dirkoir » Wed Sep 24, 2014 5:59 pm

Since xkb is so. hm. mysterious. (meaning hard to edit by dint of obtuseness, complexity, and so-so documentation). and since the only GUI tool which I found so far for xkb editing does unfortunately not make xkb more accessible (like a more assistive GUI tool would do by displaying the glyphs you get when you hold down modifier keys alone or in combination and letting you edit them by clicking on them and choosing or entering the glyphs of choice), I am for now experimenting with a workaround:

Steffen Brüntjen’s EurKEY keyboard layout
http://eurkey.steffen.bruentjen.eu/

It makes typing German special character real easy: a one-step process much like I asked for, except that it uses the AltGr key instead of Alt. I found that if I am switched to this keyboard (which comes without a flag icon for the Keyboard Applet (I wonder how that is configured)), it overrides (or takes over) the AltGr as Compose Key; but if I add the left Windows key to the Compose Key choices, then the standard compose key action (which I was previously using when set to the default US keyboard) still works for easily typing Spanish or French. (This confirms my suspicion from looking at EurKEY’s code that EurKEY only provides supplementary key action rather than a complete set.)

This method gets close to what I want (1. no dead keys hampering the typing of punctuation, 2. few typing steps to take for special characters, and 3. no need for constant keyboard switching), although I will have to get used to the fact that I need to access different language’s special characters by different methods in this configuration: compose key for Spanish/French (thankfully an easy compose key sequence) and a single chord (the preferred method) for German.
Also, I’d rather have the access keys (Win and AltGr switched, because I type German special characters more often and find Alt easier to use than AltGr). But, then, Steffen Brüntjen may have run into the same apparent unwillingness of xkb to use Alt for a modifier key as I did in my mind-bending readings. (I think there is a way to get xkb to play nice with the Alt key, but I don’t know what that is, or if it won’t mess with Alt-tab for window switching (ike xmodmap and its GUI frontend xkeycaps have been reported to do, if I recall correctly).)

This configuration also kills the use of the Windows key for launching the Mint Menu, but since in LM 17 the Mint Menu can’t be completely operated via the keyboard anyway (as far as I have been able to determine), that is not a huge loss. Still, if something like Alt-Win or Ctrl-Win would open the menu, I’d be slightly happier.

Источник

Оцените статью
Adblock
detector