I have a custom keyboard layout that I want to install like this:

$sudo apt install my-custom-kbd-layout

Is this possible with Debian?

Because I started writing some python script to automate the manual steps, but maybe I'm over complicating things. Is there a better way?

Edit: removed code

  • This looks like a code-review question. – Stan Strum Jan 3 '18 at 17:43
  • The code is for reference here, not for reviewing. – aliopi Jan 4 '18 at 12:15
  • 1
    I don’t know much about package control, but If guess you could do 2 things, assuming it is not the code that is the problem. 1) push this to an official/unofficial repository (make sure it is added to the repo list) and download it with apt, or 2) since it is Python, maybe you can reserve a PIP package specifically for this. – Stan Strum Jan 4 '18 at 16:27
  • 1
    I'd recommend you see how the package keyboards-rg does it (apt-get source keyboards-rg) and copy it. – angus Jan 5 '18 at 6:26
  • 1
    possible, yes. beginner friendly, no. ... i went into a brief discussion of one possible solution on a similar question on askubuntu. you might not want to submit your customizations to the official package, but could use that to make your own patch for a local build of xkb-data that includes your changes. – quixotic Jan 9 '18 at 4:40

Package keyboards-rg provides several keyboard layouts aimed at Eastern European users. By examining its source (retrieve it with apt-get source keyboards-rg) you can see what files you need to provide, what to put in the debian/ directory, etc.

  • I'll put the url to source in case someone else is interested packages.debian.org/stretch/keyboards-rg – aliopi Jan 5 '18 at 17:33
  • For other people who want to make a keyboard package, I found this excellent answer here superuser.com/a/1168603, which confirms what I hoped would not be. Because I use Gnome, I can't avoid editing the evdev.lst and evdev.xml files. Why is this a problem? Because system updates will overwrite my change. The other problem is that I have to write a script to insert the snippets for my custom keyboard at the right place, without deleting other custom edits or breaking something. Very complicated, I was hoping a "plugin" style architecture was possible. – aliopi Jan 8 '18 at 10:36
  • There is another problem with the setxkbmap aproach, it completely overrides my Gnome settings. So if I have de activated in Gnome and then do setxkbmap xy, xy will be active in every window or terminal but Gnome still shows de as active. Switching keyboards in Gnome with Win + Space I can see the keyboard symbols switching but actually nothing happens; I expected it would override the setxkbmap xy command. – aliopi Jan 8 '18 at 10:56
  • @aliopi Once you manage to do it, please write a better answer and assign it to you. It'll be an asset for the site. – angus Jan 8 '18 at 16:18
  • 1
    @aliopi the answer you link mentions disabling gnome's settings daemon if you prefer the setxkbmap approach. you do need to understand setxkbmap needs all the layouts you want: you'll need setxkbmap -layout de,xy to get both layouts. on the other hand, if you make changes to the system files correctly you'll be able to use gnome's builtin handling. – quixotic Jan 9 '18 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.