Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Creating a custom keyboard layout

  1. #1
    Join Date
    Aug 2008
    Beans
    51

    Creating a custom keyboard layout

    There have been some posts on this forum about custom keyboard layouts, but the latest one was more than three years ago, and is outdated. I found the following code for a custom dvorak international keyboard layout here, but it directs me to copy this code into the folder /etc/X11/xkb/symbols/pc, a folder which does not seem to exist in 9.10 or 9.04.
    Code:
    partial default alphanumeric_keys
    xkb_symbols "basic" {
        name[Group1]= "Dvorak international extended";
    
        // Alphanumeric section
    
        key <TLDE> { [       dead_grave, dead_tilde	]	};
    
        key <AE01> { [	    1,	exclam, exclamdown, U00B9 ] };
        key <AE02> { [	    2,	at, U00B2 ]		};
        key <AE03> { [	    3,	numbersign, U00B3 ]	};
        key <AE04> { [	    4,	dollar, currency, U00A3	] };
        key <AE05> { [	    5,	percent, EuroSign ]	};
        key <AE06> { [	    6,	dead_circumflex, U00BC ]};
        key <AE07> { [	    7,	ampersand, U00BD ]	};
        key <AE08> { [	    8,	asterisk, U00BE	]	};
        key <AE09> { [	    9,	parenleft, U2018 ]	};
        key <AE10> { [	    0,	parenright, U2019 ]	};
        key <AE11> { [ bracketleft,	braceleft, guillemotleft ] };
        key <AE12> { [ bracketright, braceright, guillemotright ] };
    
        key <AD01> { [  dead_acute, dead_diaeresis, U00E4, U00C4 ] };
        key <AD02> { [	comma,	less, U00E5, U00C5 ]	};
        key <AD03> { [      period,	greater, U00F6, U00D6 ] };
        key <AD04> { [	    p,	P, paragraph, degree ]	};
        key <AD05> { [	    y,	Y, U00FC, U00DC	]	};
        key <AD06> { [	    f,	F		]	};
        key <AD07> { [	    g,	G, U00E7, U00C7	]	};
        key <AD08> { [	    c,	C, copyright, U00A2 ]	};
        key <AD09> { [	    r,	R, registered	]	};
        key <AD10> { [	    l,	L		]	};
        key <AD11> { [	slash,	question, questiondown ]};
        key <AD12> { [	equal,	plus, U00D7, U00F7 ]	};
    
        key <AC01> { [	    a,	A, U00E1, U00C1	]	};
        key <AC02> { [	    o,	O, U00E5, U00C5	]	};
        key <AC03> { [	    e,	E, U00E9, U00E9	]	};
        key <AC04> { [	    u,	U, U00FA, U00DA	]	};
        key <AC05> { [	    i,	I, U00ED, U00CD	]	};
        key <AC06> { [	    d,	D, U00F0, U00D0	]	};
        key <AC07> { [	    h,	H 		]	};
        key <AC08> { [	    t,	T, U00FE, U00DE	]	};
        key <AC09> { [	    n,	N, U00F1, U00D1	]	};
        key <AC10> { [	    s,	S, ssharp, section ]	};
        key <AC11> { [	minus,	underscore, yen	]	};
        key <BKSL> { [  backslash, bar, U00F8, brokenbar ]	};
    
        key <AB01> { [   semicolon,	colon,ae, AE ] };
        key <AB02> { [	    q,	Q, U00F8, U00D8	]	};
        key <AB03> { [	    j,	J 		]	};
        key <AB04> { [	    k,	K		]	};
        key <AB05> { [	    x,	X		]	};
        key <AB06> { [	    b,	B		]	};
        key <AB07> { [	    m,	M, U00B5	]	};
        key <AB08> { [	    w,	W		]	};
        key <AB09> { [	    v,	V		]	};
        key <AB10> { [	    z,	Z		]	};
    
        include "level3(ralt_switch)"
    };
    As this is the only thing I felt Windows did better than Ubuntu (custom keyboard layouts), I would love to be able to change the layout and finally seal the deal with Ubuntu. Any help would be appreciated, and thank you for your time in reading this post.

    UPDATE:

    Roberto.tomas has written an excellent entry in ubuntu wiki about this, and includes the general information of creating a custom keyboard layout, which can be found here. For this specific keyboard layout information, however, continue reading.
    Last edited by Freiberg; May 21st, 2010 at 02:12 AM.

  2. #2
    Join Date
    Aug 2008
    Beans
    51

    Re: Creating a custom keyboard layout

    Bump.

    Anybody?

  3. #3
    Join Date
    Mar 2009
    Location
    Columbus, OH
    Beans
    4
    Distro
    Kubuntu 8.10 Intrepid Ibex

    Re: Creating a custom keyboard layout

    NOTE: this post has been edited. i got my keyboard layout working with the help given in this thread

    i've been trying to do the same thing. here's what i have so far.

    the directory that keyboard layouts are stored in for 9.10 is in /usr/share/X11/xkb/symbols/

    there is an additional file you have to edit, /usr/share/X11/xkb/rules/evdev.xml, in order to get the keyboard preferences (System->Preferences->Keyboard) to recognize your new layout. this site gives some good advice for editing the different files. (it's a tutorial for 8.10, but the files are identical, just in different directories)

    now for the problems i was having. i got Ubuntu to see the keyboard layout i made, but it wasn't really recognizing it. every time i booted up or attempted to add my new layout, i got an error:

    Error activating XKB configuration.
    It can happen under various circumstances:
    - a bug in libxklavier library
    - a bug in X server (xkbcomp, xmodmap utilities)
    - X server with incompatible libxkbfile implementation

    X server version data:
    The X.Org Foundation
    10604000

    If you report this situation as a bug, please include:
    - The result of xprop -root | grep XKB
    - The result of gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd
    ALWAYS make sure you've written your code correctly. i started my layout from scratch, and of course the problem boiled down to a few missing commas.

    my IPA keyboard layout for Ubuntu 9.10:
    Code:
    //IPA Characters
    // a custom keyboard layout by an OSU linguistics undergrad student
    // designed to use almost all of the symbols in the International Phonetic Alphabet
    
    default
    partial alphanumeric_keys modifier_keys 
    xkb_symbols "basic" {
    
        name[Group1]= "IPA Characters";
    
        key.type[Group1]="FOUR_LEVEL";
    
        key <TLDE> {[     	U0303,	U0334			]};
        key <AE01> {[     	U0298,	U02B7,	U02E9,	U033C	]};
        key <AE02> {[	U01C0,	U032A,	U02E8		]};
        key <AE03> {[	U01C2,	U033A,	U02E7		]};
        key <AE04> {[	U01C3,	U02B2,	U02E6,	U033B	]};
        key <AE05> {[	U01C1,	U029F,	U02E5,	U027A	]};
        key <AE06> {[	U02B0,	U02B1,	U02DE,	U02B4	]};
        key <AE07> {[	U02E0,	U02E4,	U207F,	U02E1	]};
        key <AE08> {[	U0324,	U0330,	U032C		]};
        key <AE09> {[	U0361,	U035C,	U203F		]};
        key <AE10> {[	U0325,	U030A,	U007C,	U2016	]};
        key <AE11> {[	U0320,	U031E,	U0319,	U0308	]};
        key <AE12> {[	U031F,	U031D,	U0318,	U033D	]};
    
        key <AD01> {[	U0259, 	U028C,	U0250,	U025E	]};
        key <AD02> {[	  w,	U028D,	U0270,	U0265	]};
        key <AD03> {[	U025B,	  e,	U025C,	U0258	]};
        key <AD04> {[	U0279,	  r,	U027E,	U0280	]};
        key <AD05> {[	  t,	U03B8,	U0288		]};
        key <AD06> {[	  y,	U028F			]};
        key <AD07> {[	  u,	U028A,	U0289,	U0339	]};
        key <AD08> {[	U026A,	  i,	U0268,	U031C	]};
        key <AD09> {[	  o,	U0254,	U0153,	U00F8	]};
        key <AD10> {[	  p,	U0239			]};
        key <AD11> {[ bracketleft,	slash,	U2193,	U2191	]};
        key <AD12> {[ bracketright,	slash,	U2198,	U2197	]};
        key <BKSL> {[ 	U027B,	U027D,	U02B5,	U02B6	]};
    
        key <AC01> {[	  a,	U00E6, 	U0251,	U0252	]};
        key <AC02> {[	  s,	U0283,	U0282,	U026C	]};
        key <AC03> {[	  d,	U00F0,	U0256,	U0257	]};
        key <AC04> {[	  f,	U0278			]};
        key <AC05> {[	  g,	U0262,	U0260,	U029B	]};
        key <AC06> {[	  h,	U0266,	U0127,	U029C	]};
        key <AC07> {[	  j,	U025F,	U029D,	U0284	]};
        key <AC08> {[	  k,	  q,	U0263,	U0281	]};
        key <AC09> {[	  l,	U026B,	U028E,	U026D	]};
        key <AC10> {[ 	U02D0,	U02D1,	U0306		]};
        key <AC11> {[ 	U031A, 	U02BC, 	U02C8,	U02CC	]};
    
        key <AB01> {[	  z,	U0292,	U0290,	U026E	]};
        key <AB02> {[	  x,	U03C7,	U0267		]};
        key <AB03> {[	U00E7,	  c,	U0255,	U0291	]};
        key <AB04> {[	  v,	U03B2,	U028B,	U2C71	]};
        key <AB05> {[	  b,	U0238,	U0299,	U0253	]};
        key <AB06> {[	  n,	U014B,	U0272,	U0273	]};
        key <AB07> {[	  m,	U0271,	U0274		]};
        key <AB08> {[	U0276,	U0275,	U0264,	U026F	]};
        key <AB09> {[     	U0329,	U032F,	U002E		]};
        key <AB10> {[     	U0294,	U02A1,	U0295,	U02A2	]};
    
        include "level3(ralt_switch)"
    };
    Last edited by zankapfel; March 2nd, 2010 at 09:04 PM. Reason: problem solved, updated code

  4. #4
    Join Date
    Aug 2008
    Beans
    51

    Re: Creating a custom keyboard layout

    Ok, and thank you for your efforts here. I'm not likely to see errors, but I will say something if I see something.

  5. #5
    Join Date
    Mar 2008
    Location
    Hungary
    Beans
    12

    Re: Creating a custom keyboard layout

    Here is a good method, which worked with intreped and now I tested on karmic liveCD. Don't know about jaunty, because when I upgraded from intrepid, some files changed in /usr/share/X11/xkb/. Now I use jaunty and custom layout works, but don't know how.

    I think the best way is not modifying files under /usr/share/X11/xkb/symbols/. Instead make your layout somewhere in your home directory, and symlink it into /usr/share/X11/xkb/symbols/
    For example if you make a layout in the file ~/my-layout, then
    Code:
    sudo ln -s ~/my-layout /usr/share/X11/xkb/symbols/my-own-layout
    All you have to modify is /usr/share/X11/xkb/rules/evdev.xml
    Put this somewhere in it, but under the <layoutList> tag:
    Code:
        <layout>
          <configItem>
            <name>my-own-layout</name>
            <shortDescription>My</shortDescription>
            <description>Layout1</description>
            <languageList><iso639Id>eng</iso639Id></languageList>
          </configItem>
          <variantList>
            <variant>
              <configItem>
                <name>mylayout</name>
                <description>Layout2</description>
              </configItem>
            </variant>
          </variantList>
        </layout>
    This evdev.xml code suppose that your ~/my-layout file starts like this:
    Code:
    xkb_symbols "mylayout" {
    The main things are:
    - the name in ~/my-layout file after xkb_symbols (in this example mylayout) should be the same as <layout><variantList><variant><configItem><name> tag in evdev.xml
    - <layout><configItem><name> should be the same as the filename in /usr/share/X11/xkb/symbols/ (in this example my-own-layout)
    - you can set the <layout><configItem><languageList><iso639Id> whatever language you want, for example if you set it to eng, your layout will be shown in System->Keyboard->Layouts->Add->By Language->English
    Here (in keyboard propeties) you will see the layout named as Layout1 Layout2, which comes from the <descripton> tags.

  6. #6
    Join Date
    Feb 2010
    Location
    Switzerland
    Beans
    15
    Distro
    Edubuntu 9.10 Karmic Koala

    Re: Creating a custom keyboard layout- How to Dvorak International with dead keys

    In reality you can simplify things as you only have one keyboard layout so you do not need the variant section but can replace the whole section with <variant/> tag

    I am using the same Dvorak International Extended keyboard with deadkeys from http://arjenvankol.com/dvorak.php .

    I have added an new post to this thread with new and better instructions and a new attachment. Please use them. Thanks!

    Here is how I got it to work.

    Save the attached text file as a file called DVX in the /usr/share/X11/xkb/symbols/ directory (I had to add the ".txt" to the end to be able to upload it). You will want to save it here instead of link to it if you want other user on the system to be able to use it.

    Then add the following lines to /usr/share/X11/xkb/rules/evdev.xml just before the </layoutList> tag.

    Code:
    <layout>
          <configItem>
            <name>DVX</name>
            <shortDescription>DVX</shortDescription>
           <description>Dvorak International Extended (dead keys)</description>
            <languageList><iso639Id>eng</iso639Id></languageList>
         </configItem>
          <variantList/>
        </layout>
    This worked for me on Karmic 9.10 the DVX show up as the layout indicator so I can differentiate it from the USA keyboard layout.

    Frederick
    Attached Files Attached Files
    Last edited by frederickjh; February 7th, 2010 at 08:52 PM. Reason: To add Note that new and better instructions have been posted to this thread

  7. #7
    Join Date
    Aug 2008
    Beans
    51

    Re: Creating a custom keyboard layout

    Ok, I'm good until the part where you edit evdev.xml. For some reason it will not let me edit that file, only read it. Do I need to run a sudo command to edit it?

  8. #8
    Join Date
    Mar 2008
    Location
    Hungary
    Beans
    12

    Re: Creating a custom keyboard layout

    frederickjh: I think your method works, because you marked your layout as default, tricky...

    Freiberg: Yes, you should edit it with
    Code:
    sudo gedit /usr/share/X11/xkb/rules/evdev.xml
    because this file is out of your home directory.

  9. #9
    Join Date
    Aug 2008
    Beans
    51

    Re: Creating a custom keyboard layout

    That almost seemed to work. I saved the file sucessfully, but when I tried to select the layout, I got the following error:

    Code:
    Error activating XKB configuration.
    It can happen under various circumstances:
    - a bug in libxklavier library
    - a bug in X server (xkbcomp, xmodmap utilities)
    - X server with incompatible libxkbfile implementation
    
    X server version data:
    The X.Org Foundation
    10604000
    
    If you report this situation as a bug, please include:
    - The result of xprop -root | grep XKB
    - The result of gconftool-2 -R /desktop/gnome/peripherals/keyboard/kbd
    Last edited by Freiberg; February 4th, 2010 at 12:17 AM.

  10. #10
    Join Date
    Mar 2008
    Location
    Hungary
    Beans
    12

    Re: Creating a custom keyboard layout

    Could you post, what you wrote in evdev.xml?

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •