gpm command provides mouse event handling in text mode. It is a daemon that runs in the background and captures mouse events and sends them to applications that are interested in them. This command is useful for those who prefer to work on the command line and want to use their mouse to navigate.
gpm, first, you need to install it on your system. To install it on Ubuntu, use the following command:
sudo apt-get install gpm
Once installed, you can start the
gpm daemon by running the following command:
sudo service gpm start
Now, you can use your mouse in the terminal. For example, you can select text by holding down the left mouse button and dragging the cursor over the text. You can also copy and paste text using the middle mouse button.
- Selecting and copying text in the terminal
- Pasting text into the terminal
- Navigating in Midnight Commander (a file manager for the terminal)
Here are the available options for the
|-t <type>||Set the mouse type (auto, microsoft, logitech, mmseries, or ps2).|
|-m <device>||Set the mouse device (default is /dev/input/mice).|
|-r <rate>||Set the mouse refresh rate (default is 100).|
|-H <history>||Set the mouse history size (default is 40).|
|-b <buttons>||Set the number of mouse buttons (default is 3).|
|-d <deadzone>||Set the mouse deadzone (default is 0).|
|-c <threshold>||Set the mouse threshold (default is 4).|
|-R||Reverse the mouse buttons.|
|-x <xoffset>||Set the horizontal offset of the mouse cursor (default is 0).|
|-y <yoffset>||Set the vertical offset of the mouse cursor (default is 0).|
|-S <scale>||Set the scaling factor for the mouse cursor (default is 1).|
|-a <acceleration>||Set the mouse acceleration (default is 1).|
|-D <debuglevel>||Set the debug level (default is 0).|
|-h||Display the help message.|
- If the mouse cursor is not moving, make sure that the
gpmdaemon is running by running the following command:
sudo service gpm status
- If the mouse cursor is moving erratically, try adjusting the mouse type, refresh rate, deadzone, and threshold using the options listed above.
gpmcommand only works in text mode, so it will not work in a graphical user interface.
- Some applications may not support mouse events, so the mouse may not work in those applications.