Closed NikoKrause closed 6 years ago
This isn't really a support forum for these types of questions. You would be better off looking for help in the forums, on #linuxmint-help or maybe even #linuxmint-dev on IRC. If you would like them to be accessible from the keyboard layouts GUI, fix your title to represent that and I'll mark it as a feature request.
So I discussed this feature request with @clefebvre on IRC. To make the work easier for people, who (in the far far future) are willing to try to implement this, I'll post a copy of our conversation, so they can benefit from the findings regarding this problem:
IRC (irc.spotchat.org #linuxmint-dev) chat with Clem about extra keyboard layouts in Cinnamon:
{NikoKrause} I have a question about keyboard layouts gui. There is a file "/usr/share/X11/xkb/rules/base.extras.xml", which has extra layouts and which aren't shown in the gui. I tried
gsettings set org.gnome.desktop.input-sources show-all-sources true
andgsettings set org.cinnamon.desktop.input-sources show-all-sources true
, but still nothing in the GUI. Is there a command, which tells the keyboard layout GUI to update the layouts?{clem} hi NikoKrause {clem} it should be org.cinnamon.desktop.input-sources show-all-sources false
{NikoKrause} clem: But the layouts in base.extras.xml still don't show up.
{clem} NikoKrause: check the source {clem} NikoKrause: you know where the settings are in github?
{NikoKrause} No, where? {NikoKrause} to you mean cs_keyboard.py {NikoKrause} Do you mean cs_keyboard.py?
{clem} NikoKrause: yes, hold on {clem} there are two kinds of configuration modules {clem} at the beginning Cinnamon started as a fork of GNOME {clem} so the settings were in C and part of cinnamon-control-center {clem} it is still the case for some of them: https://github.com/linuxmint/cinnamon-control-center/tree/master/panels {clem} network, display etc.. for instance {clem} most of them were rewritten from scratch in Python though and they're now part of cinnamon itself {clem} https://github.com/linuxmint/Cinnamon/tree/master/files/usr/share/cinnamon/cinnamon-settings/modules {clem} the keyboard one as you said is cs_keyboard.py https://github.com/linuxmint/Cinnamon/blob/master/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py {clem} as you can see it doesn't use show-all-sources
{NikoKrause} So at the time, there is no chance to get the extra layouts?
{clem} no {clem} looking at gnome-control-center, I can see it mentioned in their NEWS/Changelog, but not in their code {clem} looking at our code, it looks like cs_keyboard.py also uses ccc's region panel {clem} https://github.com/linuxmint/cinnamon-control-center/tree/master/panels/region
{NikoKrause} I think it won't be easy to implement that
{clem} could be an option in xkb somewhere, I don't know
{NikoKrause} Yeah, I asked the xkb guy Sergey Udaltsov a while ago. He offers the extras files, how to get them is the problem of the OS respectively the userinterface. "Could you please open a bug on Ubuntu so they would provide a way to list layouts from extras? May be there is one already." {NikoKrause} That was his response {NikoKrause} Thanks for your help anyway
{clem} NikoKrause: did you tell him you were a developer?
{NikoKrause} No. I created two layouts and wanted them to be in base.xml, but he wanted it to be in base.extras.xml. That's totally pointless for me, if there is no way to use them. {NikoKrause} clem: The extras layouts problem isn't only a problem in Cinnamon. I think it's in Ubuntu too. And probably more Linux derivatives. At least I get the layouts working in LinuxMint and Ubuntu, when I'm copying them from base.extras.xml into base.xml. In ElementaryOS even this way doesn't work. I think that's a general problem of XKB. I see the point why there is an extras file for layouts, which aren't used by many people. But {NikoKrause} the lack of support of getting this layouts activated, if wanted, makes the whole effort pointless. At least in my eyes.
{clem} NikoKrause: which part of the code reads that xml file though? {clem} base.xml I mean {clem} isn't that internal to the xkb library?
{NikoKrause} I think it's the same as evdev.xml {NikoKrause} clem: I looked into it. base.extras.xml and evdev.extras.xml are the same {NikoKrause} The same holds for evdev.xml and base.xml
{clem} NikoKrause: yes but I mean... we don't read base.xml in cinnamon, we ask xbk to give a list of layouts, right? {clem} if we can tell xkb to also read the extra file, say by specifying an argument or clalling xkb a different way, we can consider it {clem} otherwise it's an xbk issue {clem} xkb sorry
{NikoKrause} I don't now how xkb is calling evdev.xml? It's mentioned here: https://github.com/linuxmint/cinnamon-desktop/blob/2b56f69d10c9036283880ed3f3e3223931f849a5/libcinnamon-desktop/gnome-xkb-info.c {NikoKrause} XKB_RULES_FILE "evdev"
{clem} NikoKrause: you're onto something here.. {clem} here we specify evdev.xml ourselves https://github.com/linuxmint/cinnamon-desktop/blob/2b56f69d10c9036283880ed3f3e3223931f849a5/libcinnamon-desktop/gnome-xkb-info.c#L573 {clem} and a few lines later we look at org.gnome.desktop.input-sources show-all-sources {clem} if that's true we go on looking for evdev.extras.xml {clem} line 585
{NikoKrause} Sorry for misunderstanding. I talked about base.xml, but actually it's evdev.xml. I thought it makes no difference, because the content is the same. I looked into my layout files. I put them into evdev.xml. Not base.xml
{clem} looking at the code, it looks like setting org.gnome.desktop.input-sources show-all-sources should be enough to parse evdev.extras.xml {clem} I'm not sure that's called though..
{NikoKrause} I tried setting that true. But it had no effect for me
{clem} it doesn't look like the region panel in ccc is using cinnamon-destkop's gnome-xkb {clem} omg, the code is awful :)
{NikoKrause} :)
{clem} it looks like we're getting the layouts from libxklavier {clem} https://github.com/linuxmint/cinnamon-control-center/blob/master/panels/region/cinnamon-region-panel-xkbltadd.c#L442 {clem} I'd be happy to put all that in the bin if you ask me, and rewrite it in python using cinnamon-desktop's gnome-kbd API {clem} it's a lot of work though
{NikoKrause} I had no intention to make you so much work. It's not something that is important. I just came here with the hope, that an easy gsettings command would do the trick. {NikoKrause} If you nevertheless consider in the far far future (Mint 19, 20 or 21 ;) to rewrite it, please keep the extras in mind. {NikoKrause} For me I can live with the workaround. I just copy the layouts from evdev.extras.xml into evdev.xml.
{NikoKrause} There is already an Issue report on Github I made some time ago: https://github.com/linuxmint/Cinnamon/issues/5697
{clem} yes, I never looked into it {clem} I wouldn't fix it personally {clem} I usually encourage modules to be rewritten from scratch
{NikoKrause} Should I add this conversation as a reminder for the future?
{clem} there's only a few left which are still in C and inherited from gnome-control-center {clem} yes if you want
Under Arch, Polish Colemak resides under: /usr/share/X11/xkb/symbols/pl
and /usr/share/X11/xkb/rules/{base,evdev}.extras.xml
// Polish Colemak
// by Tomek Piotrowski <>
//
partial alphanumeric_keys
xkb_symbols "colemak" {
include "us(colemak)"
name[Group1]= "Polish (Colemak)";
key <AB01> { [ z, Z, zabovedot, Zabovedot ] };
key <AB02> { [ x, X, zacute, Zacute ] };
key <AB03> { [ c, C, cacute, Cacute ] };
key <AC01> { [ a, A, aogonek, Aogonek ] };
key <AC03> { [ s, S, sacute, Sacute ] };
key <AC07> { [ n, N, nacute, Nacute ] };
key <AC08> { [ e, E, eogonek, Eogonek ] };
key <AC10> { [ o, O, oacute, Oacute ] };
key <AD07> { [ l, L, lstroke, Lstroke ] };
include "level3(ralt_switch)"
};
Unfortunately, it's not shown by the keyboards layout selection dialog. KDE detects it, OTOH.
A workaround right now. I copy-pasted the following section
<variant>
<configItem>
<name>colemak</name>
<description>Polish (Colemak)</description>
</configItem>
</variant>
into the relevant <variantList>
in base.xml
and evdev.xml
. Now the layout is detected (no surprise).
I guess patching only evdev.xml
would suffice, right?
The solution is:
gsettings get org.gnome.libgnomekbd.desktop load-extra-items
Please add a checkbox to set this key in Cinnamon keyboard layout settings.
Many thanks for contributing to Cinnamon. Your suggestion was reviewed.
For more information on our workflow and feature requests, read https://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/faq.html.
Hey,
there are some keyboard layouts defined in
/usr/share/X11/xkb/rules/base.extras.xml
respectively/usr/share/X11/xkb/rules/evdev.extras.xml
But I can't find them under the keyboard settings. Is there a way to get them?Here's a definition of what the base.extras.xml file is for (https://www.freedesktop.org/wiki/Software/XKeyboardConfig/Rules/)