GPM

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page GPM and the translation is 94% complete.
Outdated translations are marked like this.
Other languages:
不要混淆 GDM.


本指南向你展示如何从命令行界面中设置和使用 GPM(通用鼠标服务器)。这对于新安装的 Gentoo 系统或不能或不使用 X 服务器的系统特别有用。

Kernel

内核 内核配置
Device Drivers  --->
  Input device support ---> [CONFIG_INPUT]
    <*/M> Mouse interface   [CONFIG_INPUT_MOUSEDEV]

获取 GPM

如果你刚刚安装了 Gentoo,几乎可以肯定你还没有将鼠标设置为在命令行界面 (CLI) 中工作。或者,你可能无法使用或不需要 X 服务器,但你仍然需要使用鼠标。解决方案很简单:使用sys-libs/gpm,通用鼠标服务器。

首先,你需要获得 GPM:

root #emerge --ask sys-libs/gpm

你可能已经注意到在编译过程中出现了一些警告配置服务器的信息。你必须在启动 GPM 之前执行此操作。

配置 GPM

在使用 GPM 之前,你需要取消注释与鼠标位置和协议相对应的行。你可以通过编辑 GPM 配置文件来执行此操作:

root #nano /etc/conf.d/gpm

In the next example, we have a USB mouse on /dev/input/mouse0. So, we uncomment /dev/input/mice, as this is the cumulative device for all mice on the system, and the appropriate protocol. Try using /dev/input/mice before /dev/psaux, as the latter is deprecated and can be disabled in more recent kernels. If /dev/input/mice fails, then fall back to other devices. Here is the example /etc/conf.d/gpm:

代码 GPM 配置示例
## (Please uncomment the type of mouse you have and the appropriate MOUSEDEV entry)
 
#MOUSE=ps2
MOUSE=imps2
#MOUSEDEV=/dev/psaux
MOUSEDEV=/dev/input/mice

如果你有一个滚轮鼠标,你会想要使用 imps2 协议,所以取消注释该行。如果 imps2 和 ps2 都无法工作,请参阅 GPM 信息页面 (info gpm) 以尝试其它协议。此外,如果你希望能够单击终端中的超链接以导航到网站,最好遵循 /etc/conf.d/gpm 文件中的建议:

代码 Other options
## (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\""

conf.d 文件的其余部分包含对鼠标服务器的其他建议;根据你的需要取消对各种选项的注释。参见 man gpm 获取更多信息。

运行 GPM

现在你的鼠标服务器已经安装和配置,是时候开始使用它了:

root #/etc/init.d/gpm start

你应该能看到一个光标块出现。请记住,只有 root 可以运行 GPM 初始化脚本。但是,为了避免每次开始新的会话时都必须使用 su 并运行脚本,为什么不将 GPM 设置为每次打开计算机时开始?

root #rc-update add gpm default

现在,无论何时启动计算机,当你进入登录提示时,控制台光标都会向你致意。即使你没有以 root 身份登录,鼠标服务器也会继续运行。

使用 GPM

复制和粘贴

使用工作鼠标服务器复制和粘贴大块文本非常容易。只需使用鼠标左键高亮文本(释放按钮时它会保持高亮显示),如果愿意,切换到不同的终端,定位光标,然后按鼠标中键将文本粘贴到光标的位置。请注意,你可以在不离开启动终端的情况下进行复制和粘贴。这使得将错误消息的输出发布到 Gentoo 论坛变得非常简单。

文本模式浏览和 GPM

如果你在一个屏幕上有一条消息,而在另一个屏幕上有一个文本模式的 Web 浏览器,你可以通过突出显示来复制错误消息,然后切换到另一个终端,左键单击相应的文本输入框以将其选中,然后按下鼠标中键。你的错误消息现在就可以发布到论坛。

尽管对纯文本浏览器的讨论有点超出本指南的范围,但用户不可避免地需要找到兼容的控制台浏览器。尽管 www-client/lynx 很可能是最古老且成熟的浏览器,但其界面对鼠标的支持和识别能力较差。相反,请尝试使用具有出色鼠标集成功能的 www-client/links

root #emerge --ask www-client/links

在控制台中使用鼠标的指南到此结束。快乐鼠标,冲冲冲!


This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document:
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.