• You are not logged in.
  • Index
  • Technical
  • Is it possible to swap the 'Alt' key with the 'AltGr' key?

    Is it possible to swap the 'Alt' key with the 'AltGr' key?

    • Started by Jag02
    • 7 Replies:
    • Reputation: 0
    • Registered: 04-Feb-2009
    • Posts: 51

    Is it possible to swap the 'Alt' key with the 'AltGr' key using the portable keybord layouts file?
    The reason for this is because on my new keyboard it is very uncomfortable to press the 'AltGr' key with my thumb
    as it is further down.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Yes, there should be a way. You'll need the Scan Codes for the keys you want to map, and the VirtualKey names that you wish to map them to. Haven't tried it for the alt keys and it's conceivable that something might be problematic but give it a try.

    Here's how to turn the ScrollLock key (SC 046) into a Win key, as an example:
    SC046 = LWIN    modifier
    (This line goes into  the [layout] section of your layout.ini file in the layout's directory.)

    If I'm not mistaken, the left and right Alt keys have SC038 and SC138 respectively. The Alt key name is just ALT I think, possibly LALT, and the right Alt key may be named RALT (but maybe it's something else when it's an AltGr - not sure).

    Another good tip is to use a Wide layout like I do. That way your right-hand home position is one key to the right so your thumb has a much easier job of hitting the AltGr key. Now that I'm used to it I wonder why it wasn't always like that. :)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Feb-2009
    • Posts: 51

    I have tried everything and I cannot get this to work. I have tried SC038 = RALT, SC038 = ALTGR. But
    none of this seems to work.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Did you try out the ScrollLock line first? Did you manage to map the Alt key to something else?

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Feb-2009
    • Posts: 51

    Yes. I have tried remapping SC038 = A but nothing happens.  I have tried turning the SC046 = LWIN which turns the 'Scroll Lock' key into
    the left win key but nothing happens.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Well, if the SC046 line doesn't work for you then it's not the Alt keys but your PKL skills that are lacking I suppose. Please post the layout file you use in code tags here if you want to, and I'll see if I can hack it for you.

    Btw, I think AutoHotkey recommends using ^!{RAlt} for the AltGr mapping? Better check it out...

    Last edited by DreymaR (07-Jun-2012 14:59:28)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Feb-2009
    • Posts: 51
    ; Keyboard Layout definition for
    ; Portable Keyboard Layout 
    ; http://pkl.sourceforge.net
    ;
    
    [informations]
    layoutname           = Colemak UK
    layoutcode           = Colemak
    localeid             = 00000809
    
    copyright            = (c) 2008 Dan Jacobs
    company              = Dan Jacobs
    homepage             = http://pkl.sourceforge.net/
    version              = 1.0
    
    generated_at         = Wed Aug 27 07:08:44 2008
    generated_from       = ColemakUK.klc
    modified_after_generate = no
    
    
    [global]
    ; extend_key = CapsLock
    shiftstates = 0:1:2:6:7
    img_width = 296
    img_height = 102
    
    
    [fingers]
    row1 = 1123445567888
    row2 = 1123445567888
    row3 = 1123445567888
    row4 = 11234455678
    
    [layout]
    ;scan = VK    CapStat    0Norm    1Sh    2Ctrl    6AGr    7AGrSh    Caps    CapsSh
    SC002 = 1    0    1    !    --    --    --    ; QWERTY 1!
    SC003 = 2    0    2    @    --    --    --    ; QWERTY 2@
    SC004 = 3    0    3    £    --    --    --    ; QWERTY 3#
    SC005 = 4    0    4    $    --    €    --    ; QWERTY 4$
    SC006 = 5    0    5    %    --    --    --    ; QWERTY 5%
    SC007 = 6    0    6    ^    --    --    --    ; QWERTY 6^
    SC008 = 7    0    7    &    --    --    --    ; QWERTY 7&
    SC009 = 8    0    8    *    --    --    --    ; QWERTY 8*
    SC00a = 9    0    9    (    --    --    --    ; QWERTY 9(
    SC00b = 0    0    0    )    --    --    --    ; QWERTY 0)
    SC00c = OEM_MINUS    0    -    _    --    --    --    ; QWERTY -_
    SC00d = OEM_PLUS    0    =    +    --    --    --    ; QWERTY =+
    SC010 = Q    1    q    Q    --    --    --    ; QWERTY qQ
    SC011 = W    1    w    W    --    --    --    ; QWERTY wW
    SC012 = F    1    f    F    --    --    --    ; QWERTY eE
    SC013 = P    1    p    P    --    --    --    ; QWERTY rR
    SC014 = G    1    g    G    --    --    --    ; QWERTY tT
    SC015 = J    1    j    J    --    --    --    ; QWERTY yY
    SC016 = L    1    l    L    --    --    --    ; QWERTY uU
    SC017 = U    5    u    U    --    ú    Ú    ; QWERTY iI
    SC018 = Y    1    y    Y    --    --    --    ; QWERTY oO
    SC019 = OEM_1    0    ;    :    --    --    --    ; QWERTY pP
    SC01a = OEM_4    0    [    {    {        --    --    ; QWERTY [{
    SC01b = OEM_6    0    ]    }        --    --    ; QWERTY ]}
    SC01e = A    5    a    A    --    1    !    --    --; QWERTY aA
    SC01f = R    5    r    R    --    2    @    @    ; QWERTY sS
    SC020 = S    1    s    S    --    3    £    £; QWERTY dD
    SC021 = T    1    t    T    --    4    $    $ QWERTY fF
    SC022 = D    1    d    D    --    5    %    ; QWERTY gG
    SC023 = H    1    h    H    --    6    ^    ; QWERTY hH
    SC024 = N    1    n    N    --    7    &    ; QWERTY jJ
    SC025 = E    5    e    E    --    8    *    *    ; QWERTY kK
    SC026 = I    5    i    I    --    9    (    (    ; QWERTY lL
    SC027 = O    5    o    O    )    0    )    ; QWERTY ;:
    SC028 = OEM_3    0    '    "    --    --    --    ; QWERTY '"
    SC029 = OEM_8    0    ={backspace}    ¬    --    ¦    --    ; QWERTY `~
    SC02b = OEM_7    0    #    ~        --    --    ; QWERTY \|
    SC02c = Z    1    z    Z    --    --    --    ; QWERTY zZ
    SC02d = X    1    x    X    --    --    --    ; QWERTY xX
    SC02e = C    1    c    C    --    --    --    ; QWERTY cC
    SC02f = V    1    v    V    --    --    --    ; QWERTY vV
    SC030 = B    1    b    B    --    --    --    ; QWERTY bB
    SC031 = K    1    k    K    --    --    --    ; QWERTY nN
    SC032 = M    1    m    M    --    --    --    ; QWERTY mM
    SC033 = OEM_COMMA    0    ,    <    --    --    --    ; QWERTY ,<
    SC034 = OEM_PERIOD    0    .    >    --    --    --    ; QWERTY .>
    SC035 = OEM_2    0    /    ?    --    --    --    ; QWERTY /?
    SC038 = RALT    0    --    --    --    --    --    ;QWERTY ALT
    SC039 = SPACE    0    ={Space}    ={Space}    ={Space}    ={Space}    --    ; QWERTY Space
    SC056 = OEM_5    0    ={enter}    |        --    --    ; QWERTY OEM_102
    SC053 = DECIMAL    0    .    .    --    --    --    ; QWERTY Decimal in Numpad
    CapsLock = OEM_1    0    ={backspace}    *{CapsLock}    ={backspace}    ={backspace}    ={backspace}    ; Caps Lock
    
    ;SC00f = TAB    ={printscreen}    ={backspace}    ={backspace}    ={backspace}    ={backspace}    ; Caps Lock

    By the way, I am running Windows 7 which is 64 bit.  Cheers!

    Last edited by Jag02 (07-Jun-2012 15:38:16)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Don't know, that file is a shambles. Different numbers of states, missing semicolons before comments etc. You sure it worked well before you added the SC038 line?

    Anyway, I've tested this on a Win7 computer and it works fine for me:

    SC038 = RALT    modifier    ; Left Alt gives AltGr/RAlt
    SC138 = LALT    modifier    ; RAlt/AltGr gives LAlt

    I'd still advise against this. You'll be confused to no end on other keyboards is my prediction. Even though I have a mod which puts a bunch of keys into the middle I feel that this is a more confusing change. Let us know how it works for you, eh? :)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
      • Index
      • Technical
      • Is it possible to swap the 'Alt' key with the 'AltGr' key?