在右侧的 Safari 中打开新标签页

Open new tab in Safari on the right

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

下面是解决方法。打开“脚本编辑器”并粘贴此代码:

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

免责声明:此代码的灵感来自 xhinterMac OS X Hints 上的代码,向他致敬。

将脚本另存为 Tab in Safari on the right.scpt 在您的 ~/Library/Scripts 文件夹中(这对 Quicksilver 来说很重要)。要运行需要在无障碍设置中允许权限,系统会提示,不要丢弃。

检查 Quicksilver > Catalog 是否包含您的用户脚本,并刷新它以确保新创建的脚本在目录中。转到 Triggers > Custom Triggers,通过底部的加号添加一个并键入 tabin,结果将显示脚本。输入关闭 window。按底部的ℹ️。在“设置”下,添加快捷方式 ⌘t。在 Scope 下,select Enabled in selected applications,在文本字段中输入“Safari”,它将被自动解析。有关 scripts in Quicksilver.

的更详细说明,请参见此处

就是这样。玩得开心!

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

tell application "Safari" to activate

tell application "System Events" to tell process "Safari"
    keystroke "t" using {option down, command down}
end tell

现在知道有一个菜单项“New Tab at End”,不需要 Apple skript 或 Quicksilver 或任何东西。只需打开“系统偏好设置”>“键盘”>“快捷方式”,然后使用加号按钮添加快捷方式,如下所示: