Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FAQ] How do I use a mouse within a console?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
96140
Retired Dev
Retired Dev


Joined: 23 Jan 2005
Posts: 1324

PostPosted: Tue Jul 19, 2005 4:12 am    Post subject: [FAQ] How do I use a mouse within a console? Reply with quote

Question: I don't have an X server yet or I don't need one. How do I use my mouse in a console?

If you've just installed Gentoo, you almost certainly don't have your mouse set up to work within a command line interface (CLI) yet. Fortunately, the solution is simple. It's called gpm, the general purpose mouse server.

First, emerge gpm:
Code:
# emerge gpm

You might have noticed a few lines during the compilation that warned about configuring the server. The second step is editing the config file:
Code:
# nano /etc/conf.d/gpm

Before you can start gpm, you will need to uncomment the lines corresponding to the location and protocol of your mouse. In my case, I use a USB mouse plugged in at /dev/input/mouse0. So, I have uncommented the necessary lines. Try using /dev/input/mice before /dev/psaux, as this is deprecated and can be disabled in the latest 2.6 kernels. Here is my example /etc/conf.d/gpm:
Code:
# Please uncomment the type of mouse you have and the appropriate MOUSEDEV entry

#MOUSE=ps2
MOUSE=imps2
#MOUSEDEV=/dev/psaux
MOUSEDEV=/dev/input/mice

If you have a wheelmouse, you will want to use the imps2 protocol, so uncomment the appropriate line. Also, if you want to be able to click on hyperlinks in terminals to navigate to a website, it is a good idea to follow the suggestion in the conf.d file:
Code:
# Please uncomment this line if you want gpm to understand charsets used
# in URLs and names with ~ or : in them, etc. This is a good idea to turn on!

APPEND="-l \"a-zA-Z0-9_.:~/\300-\326\330-\366\370-\377\""

The rest of the conf.d file contains other suggestions for your mouse server; uncomment the various options according to your own needs. Please read man gpm for more information.

Now that your mouse server is installed and configured, it's time to start using it.
Code:
# /etc/init.d/gpm start

You should see a block cursor appear. Remember that only root can run the gpm init script. However, to avoid having to su and run the script every single time you begin a new session, why not set gpm to begin every time you turn on your computer?
Code:
# rc-update add gpm default

Now, whenever you start your computer, you'll be greeted by the console cursor by the time you get to the login prompt. The mouse server will continue to run even if you're not logged in as root.

One final tip: gpm makes copying and pasting large blocks of text very easy. Simply highlight the text with the left mouse button (it will stay highlighted when you release the button), switch to a different terminal if you wish, position the cursor, and press the middle mouse button to paste the text where you placed the cursor. Note that you can copy and paste without ever leaving the terminal you started. This makes posting the output of error messages to the Gentoo forums extremely simple. If you have a message on one screen and a text-mode web browser on the other, you can copy the error message by highlighting it, then change to the other terminal, left-click the appropriate text entry box to select it, and then press the middle mouse button. Voila! Your error message can now be posted to the forums.

Though discussion of text-only browsers is somewhat beyond the scope of this FAQ, inevitably users will need to find a compatible console browser. Though lynx is most likely the oldest browser, its interface has poor mouse support and recognition. Instead, try using links, the very same browser included in the Gentoo LiveCDs. links has excellent gpm integration:
Code:
# emerge links


Last edited by 96140 on Wed Jul 20, 2005 12:41 am; edited 1 time in total
Back to top
View user's profile Send private message
bravecobra
Tux's lil' helper
Tux's lil' helper


Joined: 26 Dec 2002
Posts: 130
Location: Planet Earth (sometimes)

PostPosted: Tue Jul 19, 2005 7:42 pm    Post subject: Reply with quote

To have mouse support in mc, don't forget the slang flag for mc. Having gpm in there, is not enough, it seems.
_________________
Brave Cobra
http://www.bravecobra.com
Back to top
View user's profile Send private message
genmud
n00b
n00b


Joined: 21 Sep 2003
Posts: 31
Location: Phoenix, Arizona

PostPosted: Mon Aug 22, 2005 3:29 am    Post subject: Reply with quote

Thanks for the tip :)
_________________
Yup
Back to top
View user's profile Send private message
96140
Retired Dev
Retired Dev


Joined: 23 Jan 2005
Posts: 1324

PostPosted: Mon Aug 22, 2005 8:27 am    Post subject: Reply with quote

You're welcome!

Actually, shortly after this guide was created, I created an updated version that now appears in the official Gentoo documentation pages; you can view it here.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum