Turn on thread page Beta
    • Thread Starter
    Offline

    13
    ReputationRep:
    Ok. Here is a bit of a special request.

    I'm swedish but live in Norway. As it happens the Norwegian keyboard layout sucks for coding ( special characters are all on modifier keys etc ... ) but the UK and US layouts don't have the scandinavian letters. So basically, I figured I could try to rebind the keys to stick äöeåæø on altgr and a few of the standard latin keys. So altgr+a would give æ as an example. Now I preferably want to do this in a manner which causes it to fall through to terminals, X as well as xfce, so my question is how to do it. Will probably start with a standard US layout and see if I can modify it.

    EDIT:
    Just realised that this might be a pain with capitals, but I'm sure I can find a way to work around it if I just figure out how to modify the keyboard layout :P
    Offline

    0
    ReputationRep:
    (Original post by Jonatan)
    So basically, I figured I could try to rebind the keys to stick äöeåæø on altgr and a few of the standard latin keys. So altgr+a would give æ as an example.
    I might be taking your example too literally but altgr+a does produce æ... At least it does on my (UK) keyboard layout.


    Anyway, I think the best way to go about it would be to find the file that contains your keyboard layout.

    On my system it's at /usr/share/kbd/keymaps/[arch]/...

    but it's bound to be different depending on your distro.

    Anyway, that should be your starting point at least.
    • Thread Starter
    Offline

    13
    ReputationRep:
    (Original post by ChiefNX)
    I might be taking your example too literally but altgr+a does produce æ... At least it does on my (UK) keyboard layout.


    Anyway, I think the best way to go about it would be to find the file that contains your keyboard layout.

    On my system it's at /usr/share/kbd/keymaps/[arch]/...

    but it's bound to be different depending on your distro.

    Anyway, that should be your starting point at least.
    Heh, didn't realise altgr+a woud produce æ. Well in any case I need all 5 letters. I guess I could just learn the corresponding key codes, but redefining the keyboard layout would be so much more fun.
    Offline

    14
    ReputationRep:
    To change layout in the console you need to use 'loadkeys' (I've dealt with X in the next post)

    So on bootup you might run: loadkeys /home/jonatan/.consoleKeys.kmap

    /home/jonatan/.consoleKeys.kmap would look something like:
    Code:
    alt_is_meta
    charset "iso-8859-15"  # use a ISO-8859-15 font, e.g.: consolechars -f lat9v-14
    keymaps 0-12
    # this is included from /usr/share/kbd/keymaps/i386/include/qwerty-layout.inc
    include "qwerty-layout"
    # similarly, /usr/share/kbd/keymaps/i386/include/inux-with-alt-and-altgr.inc
    include "linux-with-alt-and-altgr"
    strings as usual
    
    # now you define your custom bindings
    ########################
    
    # this would redefine altgr + t (key corresponding to keycode 20) to cent
    altgr keycode 20 = cent
    Here's how I found the keycode corresponding to 't': http://www.comptechdoc.org/os/linux/...lkeycodes.html

    Also, you probably don't want to redefine anything to cent (I doubt it'd be that useful ), but I don't know the names of the codes you want. To do that it'd probably be best to look through the keymaps for the norwegian keyboards and find their names, here what I could find:
    /usr/share/kbd/keymaps/i386/qwerty/no.map.gz
    Code:
    keymaps 0-2,4,6,8,12
    include "qwerty-layout"
    include "linux-with-alt-and-altgr"
            plain keycode  83 = KP_Comma
    strings as usual
    
    keycode   1 = Escape
            alt     keycode   1 = Meta_Escape
    keycode   2 = one              exclam
            alt     keycode   2 = Meta_one
    keycode   3 = two              quotedbl         at
            control keycode   3 = nul
            alt     keycode   3 = Meta_two
    keycode   4 = three            numbersign
            control keycode   4 = Escape
            alt     keycode   4 = Meta_three
    keycode   5 = four             dollar           dollar
            control keycode   5 = Control_backslash
            alt     keycode   5 = Meta_four
    keycode   6 = five             percent
            control keycode   6 = Control_bracketright
            alt     keycode   6 = Meta_five
    keycode   7 = six              ampersand
            control keycode   7 = Control_asciicircum
            alt     keycode   7 = Meta_six
    keycode   8 = seven            slash            braceleft
            control keycode   8 = Control_underscore
            alt     keycode   8 = Meta_seven
    keycode   9 = eight            parenleft        bracketleft
            control keycode   9 = Delete
            alt     keycode   9 = Meta_eight
    keycode  10 = nine             parenright       bracketright
            alt     keycode  10 = Meta_nine
    keycode  11 = zero             equal            braceright
            alt     keycode  11 = Meta_zero
    keycode  12 = plus             question
            control keycode  12 = Control_underscore
            alt     keycode  12 = Meta_minus
    keycode  13 = backslash        grave            apostrophe
            alt     keycode  13 = Meta_equal
    keycode  14 = Delete
            alt     keycode  14 = Meta_Delete
    keycode  15 = Tab
            alt     keycode  15 = Meta_Tab
    keycode  26 = braceright       bracketright
            control keycode  26 = Escape
            alt     keycode  26 = Meta_bracketleft
    keycode  27 = asciitilde       asciicircum      asciitilde
            control keycode  27 = Control_bracketright
            alt     keycode  27 = Meta_bracketright
    keycode  28 = Return
            alt     keycode  28 = Meta_Control_m
    keycode  29 = Control
    keycode  39 = bar              backslash
            alt     keycode  39 = Meta_semicolon
    keycode  40 = braceleft        bracketleft
            control keycode  40 = Control_g
            alt     keycode  40 = Meta_apostrophe
    keycode  41 = bar
            control keycode  41 = nul
            alt     keycode  41 = Meta_grave
    keycode  42 = Shift
    keycode  43 = apostrophe       asterisk
            control keycode  43 = Control_backslash
            alt     keycode  43 = Meta_backslash
    keycode  51 = comma            semicolon
            alt     keycode  51 = Meta_comma
    keycode  52 = period           colon
            alt     keycode  52 = Meta_period
    keycode  53 = minus            underscore
            control keycode  53 = Delete
            alt     keycode  53 = Meta_slash
    keycode  54 = Shift
    keycode  56 = Alt
    keycode  57 = space
            control keycode  57 = nul
            alt     keycode  57 = Meta_space
    keycode  58 = Caps_Lock
    keycode  86 = less             greater
            alt     keycode  86 = Meta_less
    keycode  97 = Control
    which may make more sense to you than me.
    • Thread Starter
    Offline

    13
    ReputationRep:
    (Original post by wesetters)
    I think it's reasonably doable for X (http://www.linux.com/articles/113715) but I'm not sure about terminal...
    Oh yea, that works fine. I guess I don't really need it in the terminal because if X fails I am unlikely to need scandinavian characters to fix it :p:
    • Thread Starter
    Offline

    13
    ReputationRep:
    Lol Tom, I just did it using xkb and then I saw your post here. Thanks ro the thought anyway
    Offline

    14
    ReputationRep:
    Heh, I learnt things anyway, not a total loss
 
 
 
Poll
Have you ever experienced bullying?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.