按F1键时会运行哪个命令?

我想添加一个新的热键:当我按F1时,它会像Shift + F1一样。 我添加了一个新的自定义快捷方式(系统 – >键盘),但我不知道运行命令,就像我们按F1 。 我感谢您的帮助。

如果要添加新的热键,例如按Shift + F1调用F1命令,则需要一个额外的软件作为xbindkeysxdotoolxdotool 。 我遵循使用xte

1.安装 xbindkeys

 sudo apt-get install xbindkeys 

2.然后安装 xte

 sudo apt-get install xautomation 

xte 'command key/mousebutton/xyCoordinates'的语法是这样的: xte 'command key/mousebutton/xyCoordinates'

举些例子:

  • 要拨打单键,请按: xte 'key keyName'
  • 要调用组合键: xte 'keydown keyName' 'keydown secondKeyName' 'keyup keyName' 'keyup secondKeyName
  • 和更多! 读man xte

3.找到密钥的名称: xbindkeys允许我们使用-k句柄来查找密钥或密钥组合的名称。 运行xbindkeys -k并按键或组合键。

如果您按Shif + F1,您的输出将看起来类似于:

 "(Scheme function)" m:0x11 + c:67 Shift+Mod2 + F1 

xbindkeysrc命令的基本语法如下:

 "Command to run (in quotes)" key to associate with command (no quotes) 

所以你可以在上面看到。

4. 在主目录中 创建名为 .xbindkeysrc 的文件

 touch $HOME/.xbindkeysrc 

5.现在打开 .xbindkeysrc 文件。

 gedit .xbindkeysrc 

6.将键/键组合绑定到另一个键/键组合:

因此,根据步骤2中xte语法的第一个示例,我们有:

 xte 'key keyName' 

好的,现在将此命令与在步骤3中按Shif + F1的输出组合,然后输入或输入我们在步骤5中打开的.xbindkeysrc文件,如下所示:

 "xte 'key F1'" Shift+Mod2 + F1 

7.保存并退出。 现在你可能会注意到你的命令还没有工作,那是因为xbindkeys没有运行。 要启动它,只需从终端运行xbindkeys 。 你的Shif + F1现在应该开始你的F1命令!

根据Seth的这个问答

F1键时,将打开系统文档浏览器(yelp)。

例如,您可以访问Nautilus帮助:

 yelp help:ubuntu-help/files 

来自yelp手册页:

 NAME yelp — browse system documentation USAGE yelp [file] The GNOME Help Browser includes detailed documentation for the majority of applications, utilities and other components, such as the panel or the Nautilus file manager. Yelp can display some HTML and XML files when passed on the command- line, but it's primarily called from applications. You can also start Yelp by choosing Desktop->Help. This will show the top-level help system page, listing all GNOME documents conveniently organized by topic. OPTIONS This program accepts all the standard GNOME and GTK+ options, which follow the usual GNU command line syntax, with long options starting with two dashes (`-'). To get more information about these options launch Yelp with the `--help' argument. 

要知道快捷键执行了哪些命令,打开终端并查看ps -aef命令的结果,最后一个进程之一是您的命令:

 [...] root 9013 2 0 21:18 ? 00:00:00 [kworker/u16:0] sylvain 9036 2003 19 21:20 ? 00:00:00 yelp help:gnome-terminal sylvain 9054 8851 0 21:21 pts/14 00:00:00 ps -aef