Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Assign PgUp and PgDn keys - eeePC

  1. #11
    Join Date
    Nov 2009
    Beans
    23

    Re: Assign PgUp and PgDn keys - eeePC

    To assign PgUp/PgDown to keyboard shorcuts, here is a solution that works for Firefox:

    1. Install keyconfig extension (http://forums.mozillazine.org/viewtopic.php?t=72994)

    2. Open keyconfig from Tools menu

    3. Add Page Up shortcut: goDoCommand('cmd_scrollPageUp') (assign to CTRL+Up Arrow)

    4. Add Page Down shortcut: goDoCommand('cmd_scrollPageDown') (assign to CTRL+Down Arrow)

    5. Done, restart.

    While you're at it, might as well disable the FireFox Help shortcut (F1 key) which always seems to get hit by accident

  2. #12
    Join Date
    Apr 2010
    Beans
    65

    Re: Remapping keyboard keys

    Quote Originally Posted by llazarte View Post
    The solution is to remap some keys, that is, to choose some keys on your keyboard to peform certain actions.

    In my case, I wanted to avoid having to press Fn together with Up or Down to get PageUp or PageDown.

    Step 0: Choose a key, or a key combination, to perform the desired action. In my case, I wanted to reverse the behavior of pressing Up and Fn+Up and Down and Fn+Down. That means FOUR definitions: two key definitions (Up and Down) and two key combinations (Fn+Up and Fn+Down).

    Step 2
    : Discover how your system sees those keys, using the command "xev" and pressing the keys whose id you want to discover. In my case pressing Up, Down, Fn+Up and Fn+Down produced the result below, which means:

    1. Pressing Down produces the kyecode 116, which is assigned to the action Down.

    KeyPress event, serial 31, synthetic NO, window 0x3a00001,
    root 0xa5, subw 0x0, time 13735531, (165,-16), root(170,32),
    state 0x0, keycode 116 (keysym 0xff54, Down), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

    2. Pressing Up produces keycode 111, assigned to action Up.

    KeyPress event, serial 34, synthetic NO, window 0x3a00001,
    root 0xa5, subw 0x0, time 13739005, (165,-16), root(170,32),
    state 0x0, keycode 111 (keysym 0xff52, Up), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

    3. Pressing Fn+Down produces keycode 117, assigned to action Next (page down).

    KeyPress event, serial 34, synthetic NO, window 0x3a00001,
    root 0xa5, subw 0x0, time 13751243, (165,-16), root(170,32),
    state 0x0, keycode 117 (keysym 0xff56, Next), same_screen YES,
    XKeysymToKeycode returns keycode: 105
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

    4. Pressing Fn+Up produces keycode 112, with action Prior (page up).

    KeyPress event, serial 34, synthetic NO, window 0x3a00001,
    root 0xa5, subw 0x0, time 13752671, (165,-16), root(170,32),
    state 0x0, keycode 112 (keysym 0xff55, Prior), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

    Once you know the keycode of the keys you would like to use, and the name of the actions you want to perform, you can assign the desired actions to the chosen keys.


    Step 3: The following four commands will produce the desired change, valid only for the present X session:

    Code:
    # xmodmap -e "keycode 116 = Next"; xmodmap -e "keycode 111 = Down" 
    # xmodmap -e "keycode 117 = Prior"; xmodmap -e "keycode 112 = Up"


    Step 3b
    : To get these changes for every session, after issuing the commands above, create a file called .Xmodmap (or whatever), with the following command:

    Code:
    # xmodmap -pke > .Xmodmap
    Then, create a file called .xinitrc in your home directory, containing just the following line:
    Code:
    xmodmap .Xmodmap
    Good luck!

    If i wish to swap the left control with the left alt, is this possible? I am able to swap the keycodes, and xev shows that the keys have been swapped, but actually nothing has changed. Is there something that needs to be different with these special keys? I do have a standard macbook pro keyboard.

    Thanks!

  3. #13
    Join Date
    Jun 2011
    Beans
    1
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Assign PgUp and PgDn keys - eeePC

    Looks like the original question's still not really solved, so I'd like to add a bit.
    The original xmodmap-way (post #2) only changes the keys, so the problem of needing two hands for a page-up or page-down command returns for the regular up and down actions. It may help if you use those actions less, but I really like the suggestion of majest in post #3. The solution. however, is only partial, and I don't like the idea of an additional program while Ubuntu has a very flexible keyboard functionality built in.

    I managed to replace Fn-Down with AltGr-Down using the instructions of http://people.uleth.ca/~daniel.odonnell/Blog/custom-keyboard-in-linuxx11. (I don't get this link to work directly - if necessary try copy and paste.) It describes how to make a small modification to a keyboard you are already using. Since I don't know what your keyboard settings are, I'll tell you about mine, and I hope you have something to go by. My netbook is a MSI Wind u100, with Ubuntu 10.04.
    System>Preferences>Keyboard tells me the keyboard model I've been using is "Generic 105-key (Intl) PC", with the "USA" layout. Since this setting is basically OK, I based the modified version on this keyboard. As follows:

    a. I added the following section to the file /usr/share/X11/xkb/symbols/us (at the end)

    Code:
    partial alphanumeric_keys
    xkb_symbols "netbook" {
    
        name[Group1]= "USA - Netbook optimized";
    
        include "us(basic)"
    
        include "eurosign(5)"
    
        include "level3(ralt_switch)"
    
        key <UP> { [ Up, Up, Prior, Prior ] };
        key <LEFT> { [ Left, Left, Home, Home ] };
        key <DOWN> { [ Down, Down, Next, Next ] };
        key <RGHT> { [ Right, Right, End, End ] };
    
    };
    I included "eurosign(5)" because my keyboard has an eurosign on the 5-key. You may have guessed: the lines starting with "key" define what the physical key does when pressed, Shift-pressed, 3rd-level-modifier-pressed and Shift-3rd-level-modifier-pressed (3rd-level-modifier: see below).
    For "USA - Netbook optimized" you can choose whatever text you want. For "netbook" as well, but you need this string in the next step.

    b. I added the following text to the file /usr/share/X11/xkb/rules/evdev.xml just below the similar section with name "euro". (Or somewhere else, just make sure that the section is in the <variantlist>-tag of the layout with the name "us".)

    Code:
            <variant>
              <configItem>
                <name>netbook</name>
                <description>Netbook optimized</description>
              </configItem>
            </variant>
    The name-tag has the value as specified in the new section in the us-file. The description will show up in the list of variants of the layout, see below.

    c. Using System>Preferences>Keyboard I selected "Add" to add a layout, then "United States" under Country and then the modification appears as "USA Netbook optimized" amongst the available variants. I selected it, and the modification is added to list of layouts.
    I selected this new layout and then clicked "Options". I expanded the line saying "Key to choose 3rd level" and selected "Right Alt". This specifies which modifier key changes Up to PageUp. You may select "Right Ctrl" if you wish. After closing the Keyboard settings windows, it works. Also in Firefox, by the way.

    What I'm not completely happy about is that the AltGr+arrowkeys keep working even if I switch to the original layout, and that I had to change system files. The modifications may be at risk at updates. I would rather have user-specific files overriding the default ones, but I don't know how to do that.

    I'm curious if you get it to work as well.

  4. #14
    Join Date
    Aug 2010
    Beans
    409
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Assign PgUp and PgDn keys - eeePC

    My "Return" key under-side plastic spring levers broke somehow, so, I had to temporarily remap some other key to the Return key:
    - How can I temporarily map the ENTER key to the SHIFT key (see picture)?



    Details are in the thread listed above.

    Basically, a swap of the Return key with the Shift_R failed to work reciprocally; yet a swap of the Return key with the backslash key worked just fine both ways.

    Here are the commands that worked:
    $ xev
    (ignore the first fifty lines or so)
    PRESS: \
    REPORTS: keycode 51 is the backslash behavior.

    PRESS: Return
    REPORTS: keycode 36 is the Return behavior.

    So, to swap those two keys:
    $ xmodmap -e "keycode 51 = Return"
    $ xmodmap -e "keycode 36 = backslash"

    To make these changes permanent, I created this Xmodmap file:
    $ xmodmap -pke > ~/.Xmodmap

    And, then I put this line in my ~/.Xinitrc:
    xmodmap ~/.Xmodmap

    This worked fine for temporary reassignment of keys.

    Now it's time to try to find a Lenovo X61 tablet PC keyboard underside plastic spring for the Return key!

  5. #15
    Join Date
    Aug 2010
    Beans
    409
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Assign PgUp and PgDn keys - eeePC

    Interestingly, the change was NOT permanent!

    What happened was that there was NO MAPPING on the boot screen; but as soon as I logged into the boot screen, up popped this question of whether to load the keyboard re-map file or not:


    Only after loading the keyboard map file did the mapping take effect.

    So I'd say it works ... barely ... but it's good enough for now.

Page 2 of 2 FirstFirst 12

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
  •