LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   problem creating custom xkb layout (http://www.linuxquestions.org/questions/linux-desktop-74/problem-creating-custom-xkb-layout-605568/)

drobert 12-09-2007 07:41 AM

problem creating custom xkb layout
 
Hi all!

I have a Hungarian keyboard by default, but I need to type some French letters without changing the layout, so I decided to create my own.
(Fedora Core 8)

Reading the internet I found these:
- I created a new file as /usr/share/X11/xkb/symbols/hu_fr ,file shown at bottom
- I have added 2 lines to /usr/share/X11/xkb/rules/base.lst:
under ! layout
hu_fr Hungary+french
under ! variant
standard hu_fr: Standard
- after that I executed in /usr/share/X11/xkb/symbols
xkbcomp -lhlpR '*' -o ../symbols.dir

After doing that, I havent found any new layouts, and Nautilus won't start.
Removing new file and changes to base.lst and running a xkbcomp command corrects the previous state.

File: hu_fr

// Default layout
default partial
xkb_symbols "basic_fr" {
include "hu(102_qwertz_comma_dead_fr)"
name[Group1] = "Hungary - French";
};

// 102_qwertz_comma_dead_fr
// 102 key qwertz french layout
// with decimal comma on keypad
// and with dead key support
partial
xkb_symbols "102_qwertz_comma_dead_fr" {
name[Group1] = "Hungary - 102/qwertz/comma/Dead keys FR";
include "latin"
include "hu_fr(def_102_fr)"
include "hu_fr(def_qwertz_fr)"
include "kpdl(comma)"
include "hu_fr(def_dead_fr)"
include "hu_fr(def_common_fr)"
include "level3(ralt_switch)"
};

// def_102_fr:
// The standard Hungarian 102 key + french layout
hidden partial alphanumeric_keys
xkb_symbols "def_102_fr" {
key <TLDE> { [ 0, section, notsign ] };
key <LSGT> { [ iacute, Iacute, less, greater ] };

};

// def_qwertz_fr:
// The standard Hungaryan qwertz + french layout
hidden partial alphanumeric_keys
xkb_symbols "def_qwertz_fr" {
key <AD06> { [ z, Z ] };
key <AB01> { [ y, Y, greater ] };
};

// def_dead_fr:
// Dead keys support part
hidden partial alphanumeric_keys
xkb_symbols "def_dead_fr" {
key <AE01> { [ 1, apostrophe, asciitilde, dead_tilde ] };
key <AE02> { [ 2, quotedbl, dead_caron, caron ] };
key <AE03> { [ 3, plus, asciicircum, dead_circumflex ] };
key <AE04> { [ 4, exclam, dead_breve, breve ] };
key <AE05> { [ 5, percent, dead_abovering, degree ] };
key <AE06> { [ 6, slash, dead_ogonek, ogonek ] };
key <AE07> { [ 7, equal, grave, dead_grave ] };
key <AE08> { [ 8, parenleft, dead_abovedot, abovedot ] };
key <AE09> { [ 9, parenright, dead_acute, acute ] };
key <AE10> { [ odiaeresis, Odiaeresis, dead_doubleacute, doubleacute ] };
key <AE11> { [ udiaeresis, Udiaeresis, dead_diaeresis, diaeresis ] };
key <AE12> { [ oacute, Oacute, dead_cedilla, cedilla ] };
};

// def_common_fr:
hidden partial alphanumeric_keys
xkb_symbols "def_common_fr" {
key <AD01> { [ q, Q, backslash ] };
key <AD02> { [ w, W, bar ] };
key <AD03> { [ e, E, egrave, Egrave ] };
key <AD07> { [ u, U, EuroSign ] };
key <AD08> { [ i, I, Iacute, iacute ] };
key <AD11> { [ odoubleacute, Odoubleacute, division ] };
key <AD12> { [ uacute, Uacute, multiply ] };

key <AC01> { [ a, A, adiaeresis, Adiaeresis ] };
key <AC02> { [ s, S, dstroke ] };
key <AC03> { [ d, D, Dstroke ] };
key <AC04> { [ f, F, bracketleft ] };
key <AC05> { [ g, G, bracketright ] };
key <AC07> { [ j, J, iacute, Iacute ] };
key <AC08> { [ k, K, lstroke ] };
key <AC09> { [ l, L, Lstroke ] };
key <AC10> { [ eacute, Eacute, dollar, cent ] };
key <AC11> { [ aacute, Aacute, ssharp ] };

key <BKSL> { [ udoubleacute, Udoubleacute, currency ] };

key <AB02> { [ x, X, numbersign ] };
key <AB03> { [ c, C, ampersand ] };
key <AB04> { [ v, V, at ] };
key <AB05> { [ b, B, braceleft ] };
key <AB06> { [ n, N, braceright ] };
key <AB07> { [ m, M, less ] };
key <AB08> { [ comma, question, semicolon ] };
key <AB09> { [ period, colon, greater ] };
key <AB10> { [ minus, underscore, asterisk ] };

};


Any idea?

Robert

DennisC31 12-12-2007 03:12 PM

Mon dieu, je me sens désolé pour toi.

But, I'll write in english for our other friends here.

Quote:

under ! layout
hu_fr Hungary+french
under ! variant
standard hu_fr: Standard
- after that I executed in /usr/share/X11/xkb/symbols
xkbcomp -lhlpR '*' -o ../symbols.dir
Don't change anything in the rules file. I know it may be cleaner to do it this way, but it may not be easier.

backup your /symbols/hu file.

Now, I assume that since you are using the hu layout that you are already familiar with the term ALTGR. That's the right alt key and it's used with non-english languages where there are ciromflexes and cedillas and accents, etc.

In the hu file, the altGR key is the 3rd field. You will have to add what you want that key to do in the 3rd field.

For instance, to get an accent grave with the "comma, question, semicolon" key:

key <AB08> { [ comma, question, grave ] };

Unfortunately, this means having to lose whatever was stored there in the first place.

You may want to check under system, preferences, keyboard, layouts (or something similar in Gnome / KDE) and add the french layout.

There's a way, somewhere in there, to setup changing from one layout to another.

You also may want to install SCIM. SCIM will give you a nifty menu to use to switch between layouts and it may also give you a way to hit 2 keys like alt+shift to switch between types.

This is the file that I use for an english dvorak layout with dead keys for many french (and other language) symbols:
/usr/share/X11/xkb/symbols/us

drobert 12-13-2007 03:46 PM

Well, merci beaocoup!

The fourth entry is what you can get by pressing AltGr + Shift (or CapsLock). I have already modified my 'hu' file that way that every acoute character has a circumflex (AltGr) pair, and every simple vowel has a grave pair in AlgGr.

I think this rather a workaround, but it works and i may not need any seperate layout, because i use this layout all the time.

Thanks once more!

P.s. Of course after changes to a layout file, running
xkbcomp -lhlpR '*' -o ../symbols.dir
is needed! Otherwise X will hang on next start.

smyrman 06-28-2008 09:21 PM

Quote:

Originally Posted by drobert (Post 2984831)
Hi all!

- after that I executed in /usr/share/X11/xkb/symbols
xkbcomp -lhlpR '*' -o ../symbols.dir

Robert

You my try:

# cd /usr/share/X11/xkb/symbols
# xkbcomp symbols/<layout>

xkbcomp will now tell you if there is something wrong in your <layout> file..

At least this solved my issues.


All times are GMT -5. The time now is 11:00 PM.