You are not logged in.

#1 2013-11-03 04:10:12

Creak
Member
Registered: 2013-10-23
Posts: 89

Create your own keyboard layout

Hi all!

I'd like to share a tip this time, and to prove I'm not only here to ask for support wink
I'm using the Canadian French keyboard layout and it's quite good except for one thing: the € (euro) symbol isn't mapped.

I'll give my solution for this specific problem, but based on this you'll be able to do lots of other stuff and I hope you'll share it here.

1. Back up the previous file:

sudo cp /usr/share/X11/xkb/symbols/ca /usr/share/X11/xkb/symbols/ca_legacy

2. Edit the file:

sudo gedit /usr/share/X11/xkb/symbols/ca

3. Add the euro symbol and transform this line:

    key <AD03>	{ [         e,          E ]	};

to this:

    key <AD03>	{ [         e,          E,  EuroSign ]	};

4. Remove the "ca~" file and reboot (or type "sudo xinit -- :2" if you just want to try out)

5. Bob's your uncle!

PS: Got this from the Ubuntu forums: http://ubuntuforums.org/showthread.php?t=188761
PPS: I'd really like to know more about custom layout, like for instance how GNOME put a name on these layouts so that I could officially create my own personal layout that I could find in the GNOME's list.

Last edited by Creak (2013-11-03 04:11:02)

Offline

#2 2013-11-03 04:14:06

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: Create your own keyboard layout

It's great that you want to contribute but this would be better in the wiki where it may stay around and be easier for people to find smile.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2013-11-03 04:14:30

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

BTW... compose key ftw!!!

Offline

#4 2013-11-03 11:14:12

cedeel
Member
From: ~
Registered: 2009-08-25
Posts: 176
Website

Re: Create your own keyboard layout

I did some research a while ago about this topic and came to the conclusion that it wasn't worth my time since it would always be reversed by package upgrades.
If there was a way to specify user-specific layouts in the home directory, that would just be brilliant.

Offline

#5 2013-11-03 12:57:16

Jellicent
Member
From: Berlin
Registered: 2013-09-13
Posts: 189

Re: Create your own keyboard layout

cedeel wrote:

I did some research a while ago about this topic and came to the conclusion that it wasn't worth my time since it would always be reversed by package upgrades.
If there was a way to specify user-specific layouts in the home directory, that would just be brilliant.

You could simply create your own file where layouts are stored and load that instead of, for the sake of example, the ca file.

I copied the us file, renamed it usme, and edited my layout inside there. And since that day:

setxkbmap usme dvorak-intl

Or did I miss your problem?

Offline

#6 2013-11-03 16:57:34

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

I think "setxkbmap" isn't really the GNOME way.
What would be great would be to be able to select it in the layout list.

Offline

#7 2013-11-03 19:39:37

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Create your own keyboard layout

Just an idea, what if you add your custom keyboard to `/etc/X11/xorg.conf.d/00-keyboard.conf `?

Then it should probably show up in the Gnome panel.

Example:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,usme"
        Option "XkbVariant" ",,"
EndSection

Offline

#8 2013-11-03 20:08:23

Jellicent
Member
From: Berlin
Registered: 2013-09-13
Posts: 189

Re: Create your own keyboard layout

Creak wrote:

I think "setxkbmap" isn't really the GNOME way.
What would be great would be to be able to select it in the layout list.

Was it about the gnome way? He said if it could be used by gnome it would be good. But it wasn't exclusively gnome related.

Last edited by Jellicent (2013-11-03 20:09:50)

Offline

#9 2013-11-03 20:34:40

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

@Jellicent: True. At least for me, it would be nice to find the "GNOME way" or, better, a "Free Desktop" way!
I'm not fond of modifying the Xorg conf files since now we shouldn't touch the Xorg configuration.

Offline

#10 2013-11-03 20:44:58

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

Why shouldn't you touch the files in xorg.conf.d?  They are there for... configuration, and are meant to be modified to fit your needs.  But if that raelly scares you, then you can use localectl.  After creating your own layout, just set it with localectl, which will generate a file for you in /etc/X11/xorg.conf.d.

Honestly though, I think that it is actually easier to just enable the compose key.  Since all you really want is the € sign, this can be accomplished with "Compose + = + e".  I have my right alt key set as the Compose key.  This will also give you the ability to make any number of other special characters, usually with pretty obvious key combinations.

Offline

#11 2013-11-03 20:47:33

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

It's not that it scares me, it just that Xorg is supposed to auto-configure itself now.
And moreover, it seems that GNOME doesn't set it's layout from the Xorg conf file. Maybe we can force it, but that's not the "nice" way, in my opinion.

Offline

#12 2013-11-03 20:48:21

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

I don't know for Arch Linux, but it is possible to propose a patch to the maintainer of a package?

Offline

#13 2013-11-03 20:49:32

Jellicent
Member
From: Berlin
Registered: 2013-09-13
Posts: 189

Re: Create your own keyboard layout

Creak wrote:

@Jellicent: True. At least for me, it would be nice to find the "GNOME way" or, better, a "Free Desktop" way!
I'm not fond of modifying the Xorg conf files since now we shouldn't touch the Xorg configuration.

The x conf files you are referring to are located in etc/X11/ I think. But that's also pretty.. light-headed, those are config files. Why not use them for what they are there for?
That's got nothing to do with the keyboard layouts...

Last edited by Jellicent (2013-11-03 20:50:57)

Offline

#14 2013-11-03 20:54:05

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

You can propose any patch you want.  But unless it fixes some core functionality of the package that is broken in the first place, it will not be accepted.  Part of the Arch Way is providing packages an the upstream intended. So patching is minimal, and typically most patches are simply to make it build against our very up-to-date toolchain.

Gnome may not honor the xorg.conf.d files, but they are intended to be edited if necessary.  Yes, it is supposed to autoconfigure itself to an extent, but it is not going to read your mind as to what keyboard layout you want.  In fact, the files that are provided by the X packages that reside in /etc/X11/xorg.conf.d are all in the backup array so that they won't be overwritten by an update.

So gnome may throw a wrench in your ultimate solution here, but your idea that the xorg.conf.d files should not be edited whatsoever is just plain wrong.

Offline

#15 2013-11-03 21:03:04

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

It's an intuition... I was here when we were still using XFree86 and we had to configure everything by hand. And when XFree86 was forked to create Xorg, the main goal of the developers was for the X server to self-setup automatically. To me, forcing the setup in Xorg is like forcing a setup with the root privileges: it will work, but it's not how it should be done. Moreover, setting the layout in Xorg is really not multi-user friendly. Maybe I want the Canadian layout, but someone else in my home would like the US layout. Or I've even seen guys using two layouts, one for everyday life and the other for coding.

Don't get blocked on the "GNOME way", I said it because I'm using GNOME, but I'm sure GNOME is honoring the FreeDesktop standards, which implies a standard way (for GNOME, but also KDE, XFCE, etc) to set up the keyboard layout.

Edit> Think I'll have to read this: http://www.freedesktop.org/wiki/Softwar … ardConfig/

Last edited by Creak (2013-11-03 21:05:30)

Offline

#16 2013-11-03 21:35:39

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

Ok found out where GNOME find the layout translations: http://cgit.freedesktop.org/xkeyboard-c … e/po/fr.po
I also sent an email to the maintainer of the xkeyboard-config package with a patch for the Euro symbol. Maybe he'll know how to send it to the upstream guys.
I'll keep you noticed.

Offline

#17 2013-11-03 23:58:03

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

http://www.freedesktop.org/wiki/Softwar … ardConfig/ is the upstream.  You can typically find the upstream address in the package info (pacman -Qi <package> for installed packages, or pacman -Si <package> for not locally installed packages).

Last edited by WonderWoofy (2013-11-03 23:58:33)

Offline

#18 2013-11-04 00:23:13

Creak
Member
Registered: 2013-10-23
Posts: 89

Re: Create your own keyboard layout

Thanks WonderWoofy, I don't know why I completely occluded this line when I read the "pacman -Qi".
I'll wait for an answer from the packager and I'll see what to do next.

Offline

#19 2013-11-04 01:13:13

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: Create your own keyboard layout

WonderWoofy wrote:

Honestly though, I think that it is actually easier to just enable the compose key.  Since all you really want is the € sign, this can be accomplished with "Compose + = + e".  I have my right alt key set as the Compose key.  This will also give you the ability to make any number of other special characters, usually with pretty obvious key combinations.

Oh, is that how you get the Euro? Brilliant! That's going to give me another key... Is there somewhere this stuff is defined so it's possible to find out what else is possible?

EDIT: Just thought: maybe the compose key stuff is part of the keyboard layout?

EDIT 2: I find keyboard config one of the most confusing things in Linux. I never understand what I'm meant to set as what. How do I know which model of keyboard to choose for example? And why on Earth does Linux need so many modifiers and which ones do I need given that I don't have enough keys for all of them? (ctrl, alt, super, hyper, meta... I currently have ctrl, alt and, I think, super. I just made caps lock into hyper, I hope. But should that have been meta? Out of keys again!)

Last edited by cfr (2013-11-04 01:59:48)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#20 2013-11-04 01:56:27

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

@cfr, I have only found things on the interwebs that have given a list of typically available compose key combinations.  But apparently you can also set these things with some kind of a config file.  To turn on the compose key, you can use setxkbmap or edit whatever file handles the keyboard in /etc/X11/xorg.conf.d/.  So I have this in 10-evdev.conf in the keyboard config block:

Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "XkbOptions" "caps:super, compose:ralt"
EndSection

Edit: Changed code to quote tags so I could make the change bold.

Edit2: You could also use loginctl to do this as well.  But then you end up with an additional untracked file in /etc/X11/xorg.conf.d.

Last edited by WonderWoofy (2013-11-04 01:58:01)

Offline

#21 2013-11-04 02:05:48

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: Create your own keyboard layout

Thanks. I actually tried that with localectl and it produced this:

$ cat /etc/X11/xorg.conf.d/00-keyboard.conf 
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us"
        Option "XkbModel" "pc101"
        Option "XkbVariant" "euro"
        Option "XkbOptions" "compose:ralt+capslock:hyper+shift:breaks_caps+terminate:ctl_alt_bksp+shift:both_capslock"
EndSection

Should I make caps lock super instead? Or meta? I think the windows key is already super so I guess that's less essential.

I figure if I ever feel happy with this, I'll add it to the evdev config. Right now I'd rather be able to delete the config to zero its effects if necessary as I've no idea what I'm doing!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#22 2013-11-04 02:36:01

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

Oh the caps:super thing is just something else that I enjoy.  I hate the caps lock, and always have.  So instead of using it as a caps lock I have it set up so that I can use it as the modifier key for my window managers.

It is interesting that localectl puts a '+' between each configuration, as I have always used commas and thought that was the only option.

Offline

#23 2013-11-04 03:02:05

VanillaFunk
Member
From: MA. USA
Registered: 2013-06-10
Posts: 396
Website

Re: Create your own keyboard layout

wonderwoofy ty much i just set a compose key and now i can ¿

thank you for this thread its been useful


archx86_64 : awesomewm
https://github.com/dreemsoul

Remeber to feed the squirrels

Offline

#24 2013-11-04 03:25:04

VanillaFunk
Member
From: MA. USA
Registered: 2013-06-10
Posts: 396
Website

Re: Create your own keyboard layout

is it possible to set a key to a function like reboot or shutdown? i have a lot of useless keys on this laptop and would be nice to be able to set one to a function as my powerbutton is used to hibernate.... if so thatd be awesome


archx86_64 : awesomewm
https://github.com/dreemsoul

Remeber to feed the squirrels

Offline

#25 2013-11-04 04:49:42

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Create your own keyboard layout

@VanillaFunk, I think that in order to do that you would have to use something like xbindkeys or sxhkd.  But you can look through the base.lst file in /usr/share/X11/xkb/rules to see if there is native functionality for what you are looking for.  In your case though, I would have to guess that what you are trying to do is not common, and might even be trying to remap keys that aren't even within control of Xorg at all.

Offline

Board footer

Powered by FluxBB