如何为任何Mac App创建自定义键盘快捷键

Apple logo.

Frustrated because there’s not a keyboard shortcut for a command you constantly use in a Mac app? You can create one in System Preferences!

沮丧是因为在Mac应用程序中没有经常使用的命令的快捷键吗? 您可以在“系统偏好设置”中创建一个!

First, click the Apple icon in the upper-left corner, and then select “System Preferences.”

首先,单击左上角的Apple图标,然后选择“系统偏好设置”。

Click the Apple icon, and then select "System Preferences."

In “System Preferences,” click “Keyboard,” and then click the “Shortcuts” tab.

在“系统偏好设置”中,单击“键盘”,然后单击“快捷方式”选项卡。

Click "Shortcuts" in the "Keyboard" menu.

Click “App Shortcuts” in the sidebar.

点击边栏中的“应用程序快捷方式”。

Click "App Shortcuts."

Click the plus sign (+) to add a new shortcut.

单击加号(+)添加新的快捷方式。

Click the plus sign (+) to add a keyboard shortcut.

A new window containing a drop-down menu and two text fields will appear. Click the dropdown labeled “Application” and select the Application for which you want to create a shortcut (we chose “Pages”).

将会出现一个包含下拉菜单和两个文本字段的新窗口。 单击标有“应用程序”的下拉菜单,然后选择要为其创建快捷方式的应用程序(我们选择了“页面”)。

Select the application you want to have a keyboard shortcut.

Next, open the app and look for the exact name of the menu command you want to turn into a shortcut. We chose “Page Thumbnails” from the “View” menu, as it doesn’t already have a keyboard shortcut.

接下来,打开应用程序,并查找您要变成快捷方式的菜单命令的确切名称。 我们从“查看”菜单中选择了“页面缩略图”,因为它还没有键盘快捷键。

We clicked "View" and "Page Thumbnails" to create a keyboard shortcut.

Return to the keyboard shortcut entry window and type in the exact name of the menu command you want to turn into a shortcut in the “Menu Title” box.

返回键盘快捷方式输入窗口,然后在“菜单标题”框中键入要转换为快捷方式的菜单命令的确切名称。

Then, click the “Keyboard Shortcut” box and type the shortcut you want to use to trigger it. We chose Shift+Command+K because it wasn’t already taken.

然后,单击“键盘快捷方式”框,然后键入要用于触发它的快捷方式。 我们选择Shift + Command + K是因为尚未使用它。

You can use almost any combination of Command, Option, and Control with any number, letter, or character key. You can also use Shift to make a unique combination.

您几乎可以将Command,Option和Control与任何数字,字母或字符键结合使用。 您还可以使用Shift进行独特的组合。

Type the name of the menu command in the "Menu Title" box and the shortcut you want to use in the "Keyboard Shortcut" box.

Click “Add” and the popup will close. You’ll now see your shortcut listed in the “Keyboard” preferences. In the app, you should also see your new shortcut in the drop-down menu next to its associated command.

点击“添加”,弹出窗口将关闭。 现在,您会在“键盘”首选项中看到您的快捷方式。 在应用程序中,您还将在其相关命令旁边的下拉菜单中看到新的快捷方式。

A keyboard shortcut next to "Page Thumbnails" in the "View" menu in "Pages."

From now on, whenever you press that key combination, the menu item you chose will be triggered.

从现在开始,每按一次该组合键,就会触发您选择的菜单项。

If you want to remove a custom shortcut later, just revisit System Preferences > Keyboards > Shortcuts, select the custom shortcut in the list, and then press the minus sign (-).

如果以后要删除自定义快捷方式,只需重新访问系统偏好设置>键盘>快捷方式,在列表中选择自定义快捷方式,然后按减号(-)。

自定义Mac快捷方式提示 (Custom Mac Shortcut Tips)

Creating a "Compress" shortcut for "All Applications" in Keyboard Preferences on Mac.

Keep the tips below in mind whenever you’re creating keyboard shortcuts:

创建键盘快捷键时,请记住以下提示:

  • When creating a shortcut, you must use the exact name of a menu item. This includes any capitalization, spaces, or punctuation.

    创建快捷方式时,必须使用菜单项的确切名称。 这包括任何大写字母,空格或标点符号。

  • The key combination you specify must be unique. If there’s a duplicate, one of the functions won’t execute properly.

    您指定的组合键必须唯一。 如果重复,其中一个功能将无法正确执行。

  • If the keyboard shortcut you want to use is taken, try adding Shift, Control, or both. For example, instead of Command+V (which is reserved for pasting text), you could use Shift+Control+Command+V.

    如果采用了您要使用的键盘快捷键,请尝试添加Shift和/或Control。 例如,可以使用Shift + Control + Command + V代替Command + V(保留用于粘贴文本)。

  • You can make universal keyboard shortcuts. Just select “All Applications” from the “Applications” list. Your shortcut will then work in any app that has the same menu item you type.

    您可以设置通用键盘快捷键。 只需从“应用程序”列表中选择“所有应用程序”。 然后,您的快捷方式将可在具有与您键入的菜单项相同的任何应用程序中使用。

  • “Rename,” “Compress,” and “Bring All to Front” would all make useful shortcuts. These would come in handy for window management in many apps. “Compress” works in Finder, but it also might in other programs.

    “重命名”,“压缩”和“全部显示在最前面”都是有用的快捷方式。 这些将在许多应用程序中方便进行窗口管理。 “压缩”可以在Finder中使用,但在其他程序中也可以。

Keyboard shortcuts are a powerful feature to have in your Mac arsenal. Browse your favorite apps, and see what you come up with!

键盘快捷键是Mac军械库中的一项强大功能。 浏览您喜欢的应用程序,然后看看您会想到什么!

翻译自: https://www.howtogeek.com/683469/how-to-create-custom-keyboard-shortcuts-for-any-mac-app/

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Uni-app支持自定义键盘的开发,可以通过uni-app提供的组件和API来实现。 首先,你可以使用`<input>`组件或者`<textarea>`组件来创建文本输入框,然后使用`@focus`事件监听输入框的获取焦点事件,例如: ```html <template> <view> <input @focus="showCustomKeyboard" placeholder="请输入内容"></input> </view> </template> <script> export default { methods: { showCustomKeyboard() { // 在这里调用自定义键盘的显示逻辑 } } } </script> ``` 接着,在`showCustomKeyboard`方法中,你可以编写逻辑来显示自定义键盘。你可以使用uni-app提供的页面跳转API来跳转到一个包含自定义键盘的新页面,或者使用遮罩层和弹窗组件来实现在当前页面显示自定义键盘的效果。 例如,你可以使用uni-app提供的弹窗组件`<popup>`来实现自定义键盘的效果: ```html <template> <view> <input @focus="showCustomKeyboard" placeholder="请输入内容"></input> <popup v-model="showKeyboard" position="bottom" :style="{ height: '300rpx' }"> <!-- 自定义键盘的内容 --> </popup> </view> </template> <script> export default { data() { return { showKeyboard: false } }, methods: { showCustomKeyboard() { this.showKeyboard = true; } } } </script> ``` 以上代码中,`<popup>`组件通过`v-model`绑定了`showKeyboard`变量,当`showKeyboard`为`true`时,弹窗组件会显示出来,从而展示自定义键盘的内容。 注意,以上只是示例代码,具体实现方式可以根据你的需求进行调整和扩展。希望对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值