ubuntu 自定义快捷键_在Ubuntu Linux上分配自定义快捷键

ubuntu 自定义快捷键_在Ubuntu Linux上分配自定义快捷键

ubuntu 自定义快捷键

Ubuntu includes a very limited shortcut key configuration utility which doesn’t allow you to assign hotkeys to your own applications or scripts. To get around this limitation, we can use the built-in gconf-editor utility to assign them ourselves.

Ubuntu包含一个非常有限的快捷键配置实用程序,该实用程序不允许您将热键分配给自己的应用程序或脚本。 为了解决此限制,我们可以使用内置的gconf-editor实用程序自行分配它们。

First you’ll want to load up gconf-editor by typing it into the Alt+F2 Run dialog.

首先,您需要通过在Alt + F2运行对话框中键入gconf-editor来加载它。

ubuntu 自定义快捷键_在Ubuntu Linux上分配自定义快捷键

Once in the application, navigate to the following key. If you are familiar with regedit on Windows, this is very similar.

进入应用程序后,导航至以下键。 如果您熟悉Windows上的regedit,这非常相似。

apps \ metacity \ keybinding_commands

应用\ metacity \ keybinding_commands

You’ll notice a bunch of values on the right. These are the available commands that you can create for assigning to shortcut keys in the next step.

您会在右边看到很多值。 这些是您可以在下一步中分配给快捷键的可用命令。

Double-click on command_1 and enter in the full path to your script or executable that you are trying to run. (Note that you can use the which command from the shell to find the path most of the time)

双击command_1,然后输入要运行的脚本或可执行文件的完整路径。 (请注意,您大多数时候可以使用shell中的which命令来查找路径)

ubuntu 自定义快捷键_在Ubuntu Linux上分配自定义快捷键

Now navigate to the key “global_keybindings”, which is directly above the one we were on.

现在,导航至键“ global_keybindings”,该键位于我们所在的键的正上方。

ubuntu 自定义快捷键_在Ubuntu Linux上分配自定义快捷键

Here you will want to select run_command_1. Enter in the shortcut key in plain text. For instance, for Alt+T, you’ll do <Alt>T. You could use <Ctrl>T or <Alt><Ctrl>T, or whatever you want to assign to the key.

在这里,您将要选择run_command_1。 以纯文本形式输入快捷键。 例如,对于Alt + T,您将执行<Alt> T。 您可以使用<Ctrl> T或<Alt> <Ctrl> T,或任何您想分配给键的东西。

You can also create custom commands in the keybinding_commands and assign them in the global_keybindings if you want. Just remember that the keybindings will start with run_(name of command).

您还可以在keybinding_commands中创建自定义命令,并根据需要在global_keybindings中分配它们。 只需记住,键绑定将以run_(命令名称)开始。

翻译自: https://www.howtogeek.com/howto/ubuntu/assign-custom-shortcut-keys-on-ubuntu-linux/

ubuntu 自定义快捷键