1

我最近从 Mac OS Sierra(是的,我知道我迟到了)搬到了 High Sierra,我被迫更新到 Safari 版本 13.1.2。现在,我对它在我的活动选项卡旁边打开新选项卡 (⌘t) 感到非常恼火,而不是像以前那样在右侧打开。

4

3 回答 3

2

现在知道有一个菜单条目“结束时的新标签”,不需要 Apple 脚本或 Quicksilver 或任何东西。只需打开系统偏好设置 > 键盘 > 快捷方式,然后使用加号按钮添加快捷方式,如下所示:

应用程序:Safari.app,菜单标题:末尾新标签,键盘快捷键:⌘T

于 2020-12-14T15:24:56.830 回答
1

我相信在 Safari 中,使用键盘快捷键⌥ ⌘ T会在最右边打开一个新标签

tell application "Safari" to activate

tell application "System Events" to tell process "Safari"
    keystroke "t" using {option down, command down}
end tell
于 2020-12-09T00:08:50.613 回答
0

所以这里是如何解决它。打开“脚本编辑器”并粘贴以下代码:

tell application "Safari"
    if windows is {} then
        make new document
    else
        tell first window
            set current tab to last tab
            tell application "System Events" to tell process "Safari" to tell menu bar 1 to tell menu bar item "File" to tell menu 1 to click menu item "New Tab"
        end tell
    end if
end tell

免责声明:此代码受到Mac OS X Hints上的xhinter代码的高度启发,所有这些都归功于他。

将脚本保存Tab in Safari on the right.scpt在您的~/Library/Scripts文件夹中(对于 Quicksilver 找到它很重要)。要运行它,您需要在辅助功能设置中允许应用程序的权限,系统会提示您,不要丢弃它。

检查Quicksilver > Catalog是否包含您的用户脚本,并刷新它以确保新创建的脚本在目录中。转到Triggers > Custom Triggers,通过底部的加号添加一个并输入tabin,它将显示脚本作为结果。Enter 关闭窗口。按底部的ℹ️。在设置下,添加快捷方式⌘t。在 Scope 下,选择Enabled in selected applications,在文本字段中输入“Safari”,它将自动解析。有关Quicksilver中脚本的更详细说明,请参见此处。

就是这样。玩得开心!

于 2020-12-08T22:25:39.133 回答