Keyboard Annoyances

This post was published 8 years, 11 months ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

As with everything, increased computer usage tends to form certain habits. In most cases, there is nothing wrong with this, however, when things change, these habits can be significantly disrupted. Two such irregularities, and their solutions, are outlined below.

The International Keyboard
Many laptops come with keyboards that natively support multiple languages (e.g. provide accents). Many of these tend to be located on the presumably less used keys (e.g. brace brackets), however, those who program will certain make use of all these ‘uncommon’ keys. By default, Windows installs support for multiple keyboards if the hardware supports it, and provides a shortcut for rotating between them. By default, this shortcut is Left Alt + Shift. Naturally, this ends up being typed inadvertently when one least desires it and can be quite an annoyance. Luckily, it can be disabled easily enough:

Under Windows 7/Vista:

Control Panel > Region and Languages > Keyboards and Languages > Change Keyboards

Under Windows XP:

Control Panel > Regional and Language Options > Languages > Details > Settings

From here, it is possible to remove keyboards (simply highlight and click remove).

The shortcut key can be changed or disabled from Advanced Key Settings:
Windows 7/Vista: Goto Advanced Key Settings tab
Windows XP: Click Key Settings (button on the General tab)

The Function Keys (specifically Home and End)
**This method involves registry editing and should be undertaken with care**

On my laptop (MSI CR620) the Home and End keys are accessible as function keys on PgUp (Page Up) and PgDn (Page Down) respectively. Unfortunately, I use Home and End a lot, and almost never use PgUp and PgDn. Far too many times I have inadvertently pressed PgUp actually wanting Home. Luckily, this annoyance is easily remedied. While there are pieces of software available for the same purposes, this approach sets registry keys directly.

Windows supports remapping of keys – that is to say, pressing a physical key can be passed as a press of a different key to the target application.

To remedy the above problem, I opted to go with the following remaps:
Home becomes PgUp, PgUp becomes Home, End becomes PgDn, PgDn becomes End

Remaps are stored in a key called ‘Scancode Map’. This key is found in:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

(Alternatively, if you only wish to change the mappings for the current user, HKEY_CURRENT_USER\Keyboard Layout can be used)

The Scancode Map key does not exist by default, and must be created if you want to remap keys. The general structure is as follows:

{8 null bytes} {01+number of remaps} {remap pairs; 4 bytes per pair} {4 null bytes}

Each remap pair is structured as follows:

{output/desired key scan code; 2 bytes} {input/physical key scan code; 2 bytes}

The following are the scan codes for the affected keys:

Home: 47 E0
End:  4F E0
PgUp: 49 E0
PgDn: 51 E0

This gives the following remap pairs:

Home becomes PgUp: 49 E0 47 E0
PgUp becomes Home: 47 E0 49 E0
End becomes PgDn:  51 E0 4F E0
PgDn becomes End:  4F E0 51 E0

Putting these together, the value of the Scancode Map key should be set to:

00 00 00 00 00 00 00 00 05 00 00 00 47 E0 49 E0 49 E0 47 E0 4F E0 51 E0 51 E0 4F E0 00 00 00 00

For ease of implementation, this can be put into a reg file, as follows:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,05,00,00,00,47,E0,49,E0,49,E0,47,E0,\
4F,E0,51,E0,51,E0,4F,E0,00,00,00,00

A restart is required for these changes to take effect.

References:

4 thoughts on “Keyboard Annoyances

  1. Great post!
    As a developer, I can’t live without a direct access to the Home/End keys.
    MSI should definitely map their keyboards like that by default.
    Thanks a lot mate!

    • Glad you found it useful – I am in the same boat – home/end keys are used all the time and Page Up/Page Down aren’t really used.

  2. Hey! I tried this trick on Windows 8.1 but it doesn’t seem to work. Do you have a similar solution for this that works with Windows 8.1?

    • I have never used Windows 8.1 – so, unfortunately, am not aware of the specific modifications that would be required for it to work on that version. If you do find a similar solution, I would be interested in knowing what changes were required for it to work on Windows 8.1

Leave a Reply

Your email address will not be published. Required fields are marked *