How to use Microsoft 4th and 5 keys in linux

Source: Internet
Author: User
This article mainly introduces how to use the Microsoft Mouse 4th and 5 keys in linux. For more information, see

Although most users of linux do not like Microsoft very well, it cannot be denied that Microsoft has made many good things, such as Microsoft Mouse (IE series) icon_smile.gif IE 2.0 and later versions both have five buttons. in addition to the normal left, right, and left, each side also has one button. in windows, it is convenient to support the browser's forward/backward function. In fact, the same function can be completed with a slight configuration in linux. why not?

(1) explain how to process the mouse buttons and scroll wheel in linux.

In linux, the scroll wheel is processed as two buttons. roll up is one and roll down is another. Take IE2.0 as an example. There are seven buttons in total: three buttons in the left, one in the right, one on both sides, and two rollers.

(2) modify X configuration

First, let's consider that your machine only has one mouse, because my experiment was conducted in an IBM notebook, and the Microsoft Mouse was my second mouse (don't forget, there is another notebook.) more than one such situation is complicated and I will discuss it later.

The configuration file/etc/X11/XF86Config to be modified, or/etc/X11/XF86Config-4, if both have the second one.

Find the section about the mouse, which is generally as follows.

Code:

Copy codeThe code is as follows:
Section InputDevice
Identifier Mouse0
Driver mouse
Option Device/dev/mouse
Option Protocol IMPS/2
Option Emulate3buttons no
Option ZAxisMapping 4 5
Option Buttons 5
EndSection

The Identifier and Device fields are different from each other's machines, so we don't have to worry about it. We need to modify other Fields. the modified configuration is as follows:

Code:

Copy codeThe code is as follows:
Section InputDevice
Identifier Mouse0
Driver mouse
Option Device/dev/mouse
Option Protocol assumerps/2
Option Emulate3Buttons no
Option ZAxisMapping 6 7
Option Buttons 7
EndSection

Note:

The Option Device field indicates the type of the mouse. here, it is changed to the type of Microsoft Mouse. if it is a mouse of another model, such as render technology, it should be feasible as long as the model code is entered correctly. As for the normal 5-key mouse, it won't work with IMPS/2 lines. I haven't tried it;

The Option Buttons field specifies the number of Buttons. the calculation method is described earlier;

The Option ZAxisMapping field specifies the two buttons mapped to the scroll wheel. This field is also interesting. no matter how many buttons your mouse has, it should be 4 or 5. However, X can only recognize the last two buttons as the mouse, so it must be changed to 6 7, and the consequence is: cursor

(3) restart X

After the configuration is modified, restart X to see our results. Enter xev in the command line for testing.

Move the mouse to the small window and press the buttons of the mouse and scroll the scroll wheel up and down. the words "button 1, button 2,... button 7" should appear in the window. (Note: When the mouse is pressed, it must be released. this is how the mouse works)

If you can see button 1... button 7, congratulations.

Now we need to solve the problem of wheel and button inversion on both sides. Enter

Code:

Copy codeThe code is as follows:
Xmodmap-e pointer = 1 2 3 6 7 4 5

Re-order the inverted button! Now all the settings are complete. find a browser that supports keys 4 and 5, such as Firefox.

In linux, you can easily "forward" and "backward.

Next we will talk about other issues.

(1) since xmodmap-e pointer = 1 2 3 6 7 4 5 needs to be manually executed every time X is started, how can this be automatically executed?

This is not part of the scope discussed in this article. I 'd like to write it here for your convenience.

Since this command must be executed after X is started every time, it is useless to write it in files such as. bashrc. Some systems. xinitrc or. xsession do not work either. It seems that the problem is very complicated. different linux hair styles and desktop systems are different.

Let me take RedHat as an example.

If you use Gnome, do this: Create an executable script in your Directory, such as mouse. sh.

Code:

Copy codeThe code is as follows:
#! /Usr/bin/bash
Xmodmap-e pointer = 1 2 3 6 7 4 5

Remember to save chmod + x mouse. sh.

Go to gnome, find the session in Settings> other settings, and add mouse. sh to the startup program.

If you use KDE, create a. kdestart file in your Directory and write

Code:

Copy codeThe code is as follows:
#! /Usr/bin/bash
Xmodmap-e pointer = 1 2 3 6 7 4 5

You can.

(2) how to correctly configure a system with more than one mouse (such as an IBM notebook?

The configuration is actually the same, but the problem is that xmodmap seems to only support CorePointer, that is, the first mouse. in this way, the default configuration, your Microsoft mouse wheel is the left and right keys, "normal" cannot come.

My solution is to manually disable the mouse that comes with the notebook (I don't know if I can set the USB mouse to CorePointer. I didn't try it, ).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.