Changing mouse settings from command line
To configure mouse settings from command line we can use an utility called "xinput". The manual for xinput defines it as a utility to list available input devices, query information about a device and change input device settings. i.e. xinput can be used to configure a variety of input devices like mouse, keyboard etc...
List Connected Devices
On a GNOME 3.x desktop we can open command launcher (Alt+F2)
and then use the command "gnome-terminal"
to open terminal.
To list all the devices connected to a machine we can run the following command in terminal xinput --list
. In the following screenshot you can find that an optical mouse is connected to the machine and assigned a "device id 8".
Enable and Disable the device
Sometimes we don't want mouse movement to bring up a machine from sleep. To disable the input device(mouse), we find the device id by listing all devices as shown above. After finding the device id of the mouse (8) we can run the following command in terminal to disable the mouse xinput --disable 8
. Similarly to enable mouse again we can run the command xinput --enable 8
. To make things more convenient we can set keyboard shortcuts for these commands as shown below
Switch mouse buttons from right handed to left handed
I for one use, "left handed" mouse settings . I find that on some "light weight" desktops, GUI based mouse settings are often not available which makes changing mouse settings a hassle. xinput comes to the rescue in these cases. To get the default mouse button mapping the following command can be used :- xinput get-button-map 8
. To change the default mapping from right to left you can use the command xinput set-button-map 8 3 2 1
. The following screenshot shows the demo.
The above setting made through terminal will last only for one login session but, we can "apply" this setting every time we login by plugging the relevant command into the ~/.profile
file in "home" directory as shown below.
thank you for sharing it with us. this is very helpful post. Beefjerky.com Free Delivery
ReplyDelete