当前位置: 首页>>技术教程>>正文


在ubuntu中是否有键盘快捷键用于中键单击?

, ,

问题描述

Shift插入将粘贴剪贴板中的内容,但是单击中键(粘贴选定的文本)似乎没有我可以找到的键盘快捷键。这是ubuntu。有人知道吗

最佳回答

使用需要安装xkbset(可以使用Synaptic软件包管理器)。然后为how-to看到此blog post

引用博客文章:

First, we need install an old accessibility extension to X which is called xkbset. In Ubuntu or Debian, just sudo apt-get install xkbset. The original idea of this software is to provide support for people who might not be able to use a mouse or keyboard so well, so it enables things like MouseKeys (control the cursor with the numpad) and StickyKeys (hit shift, lift off, type a letter, get a capital), and SlowKeys (only register a keypress after a certain amount of time). But we’re going to use it to map a keyboard key to a mouse button with MouseKeys.

First, we’ll get rid of all the cursor-control stuff, so you can still use your numpad. As root, edit the file /usr/share/X11/xkb/compat/mousekeys and remove everything between interpret.repeat= False; and // New Keysym Actions. Notice this maps some new “keysym” actions below, specifically the one called Pointer_Button2.

Next, we’ll make a script to configure xkbset, to turn MouseKeys on, to not turn it off after a period of inactivity, and to map a key of your choice to middle-click. Here’s my ~/.middle-click.sh:

#!/bin/bash # set XKB layout setxkbmap -layout us # turn on mousekeys xkbset m # stop mousekeys expiring after a timeout xkbset exp =m # map keysym to other keysym xmodmap -e "keysym Menu = Pointer_Button2" # this also works # xmodmap -e "keycode 135 = Pointer_Button2" 

This maps the Menu key (it’s between Right Alt and Right Ctrl on my keyboard, looks like a menu with a mouse cursor) to mouse button 2, which is middle click. Notice I can also use any other key on the keyboard, by commenting out the keysym line, and using the keycode line. Keycodes are different from keyboard to keyboard, so to get the keycode of the key you wish to use, run xev in a terminal, push the key you desire, and watch the terminal output.

For the Mac users, left-click is button 1, and right-click is button 3. If I was using a Mac, I imagine I’d map Right Command to Button2, and Right Option to Button3. I hope the right side of these buttons has a different keycode to the left side. If not, I’ve read of people using F11 and/or F12. man xmodmap will tell you how to use a modifier like Cmd+F12 if you so desire.

Under Gnome, I use System -> Preferences -> Sessions to start this script as I log in, so I don’t have to worry about it again. Don’t forget to make your script executable with chmod +x ~/.middle-click.sh

次佳回答

根据程序,尝试SHIFT + INSERTCTRL + SHIFT + INSERT

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/10866.html,未经允许,请勿转载。