8

I have a new keyboard layout that is working so far. I want to ship this to users who most probably will have minimal knowledge of Linux. Trouble is to install this layout I have to do a lot of copy paste inside the files in /usr/share/X11/xkb directory. Here are the steps that I am needing to perform.

  • Add the keyboard layout to /usr/share/X11/xkb/symbols/in
  • Add the language to base.xml
  • Add the language to evdev.xml
  • Add the layout to base.lst

How do I make it so that user double clicks on the layout file and it is installed.

I am familiar with shell scripting, so I could do some file manipulation using awk or sed. But, I am not sure I should be doing that.

4
  • 1
    To do these things would require escalated privileges, which (I hope) your users don't have and so won't be able to run a script that does these things anyway. If you have a large number of assets, I'd recommend a configuration management tool like Puppet for mass deployment.
    – Joseph R.
    Sep 13, 2014 at 8:59
  • Well, this is not for a professional environment, so puppet probably is too technical and I don't have access to end user's PCs. I am merely looking for a double click installation or a import in some Keyboard layout importer application. How do they normally do it. There's gotta be a way seeing how many fonts are out there, no ? Sep 13, 2014 at 9:59
  • 1
    Fonts are very different from keyboard layouts - they are generally just adding a new file, not editing existing ones, and are much more widely distributed than keyboard layouts. There isn't good support for adding new keyboard layouts into the existing files on the system, they're generally added into the upstream XKB-config files and picked up by the packagers.
    – alanc
    Sep 15, 2014 at 17:34
  • "they're generally added into the upstream XKB-config files and picked up by the packagers." Could you please expand on that and how does one go about adding them to upstream config files. Sep 15, 2014 at 18:13

2 Answers 2

2
+100

Can't your user just click on icon which will run xkbcomp or xmodmap which will load the layout?

Edit:

I believe it's not so simple task. You will need to prepare a method of deploying files in places that only root user can access. Probably preparing a system software package (like .deb or .rpm) is best idea. I would use puppet ;-) It would add xkb keyboard layout then you have to add new layout to users' configuration. I can't help you with KDE but in gnome there is a simple tool to get/set settings of dconf – gnome setting store. It is gsettings and it can set up xkb input sources.

Example:

read input sources:

`gsettings get org.gnome.desktop.input-sources sources
[('xkb', 'pl'), ('xkb', 'us')]

setup new keyboard layoyts:

gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'pl'),('xkb','us'),('xkb', 'de+mac')]"`

and there will be an input-sources applet in "systray" user can choose from: enter image description here

But it is for one user only. To make such settings system wide you need to prepare a schema in /etc/dconf/db/localxkb:

[org/gnome/desktop/input-sources]
sources="[('xkb', 'pl'),('xkb','us'),('xkb', 'de+mac')]"

One single software package, which will be installed by user using software management software would do the thing.

9
  • Ok, I guess you are hinting at creating a shell script and making that available to the user to run to complete the install. Unfortunately my exposure to xkbcomp and xmodmap is very limited. Would you happen to have any examples ? if not could you please elaborate on that. Sep 15, 2014 at 18:15
  • 1
    I did not understand your intentions in your question. Do you want user to click whenever he/she wants to install your keyboard layout, or you need a installation method to permanently install your keyboard layout in users' xorg session. Both are possible. But which one do you need? Sep 15, 2014 at 18:34
  • 1
    If you will be using puppet, you do not need any packaging, because puppet runs on client system as root and can modify/add any file. Here is an example of playing with xkb using puppet. So the alternatives are using puppet or making a software package. Sep 16, 2014 at 18:08
  • 1
    Also, here are some xkb related deb packages with sources and a link to documentation. Sep 16, 2014 at 18:19
  • 1
    I'm afraid I'm not into deb packaging enough to help you. I gave you a link to example, ready to use package with extra xkb layouts as yours. This is all I can do right now. But making a package is not that hard and is mainly a shell scripting. With my examples you should cope. Sep 17, 2014 at 8:25
0

I have exactly the same problem. I've "solved" it by using the following script package:

https://www.dropbox.com/s/gwmebvpz70oj9c6/MXB_AltGR_XKB.tar.gz?dl=0

This is a series of scripts which install the kb in the lists and allow it to be selected from the list of installable keyboards. It must be run as root with sudo. It also features an uninstall function which puts everything back the way it was. The scripts are designed so that a mildly sophisticated user can modify the keyboard to his own desires and re-install the new version using the same scripts.

This works great on English language installs. Although it sometimes disappears on updates. When you change the system language to Spanish (I'm in Mexico) the KB is still there, but doesn't appear on the translated lists of keyboards. Where is this translated list kept? I'd be happy to make my scripts change the Spanish versions too, but I can't find them anywhere!?! Does anyone know the answer?

1
  • 3
    Your post is halfway between an answer and a question, please edit it, state that it is for English only and, if you want, post a new question about how to adapt your scripts to work for Spanish and/or other languages.
    – Anthon
    Jan 18, 2015 at 14:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .