在 macOS Finder 中添加“在 VS Code 中打开”图标

假设我在 Finder 中,打开一个文件夹,并且想要在 VS Code 中打开它。 我该怎么做呢?通常情况下,我会转到上一级文件夹,拖动该文件夹并将其放入 Dock 中的 VS Code 图标中。 或者我会转到终端并输入 code . 但是,今天我花费了一些时间,让这个过程变得更容易,通过在 Finder 工具栏中添加一个按钮: 下面是你也可以这样做的方法。 打开 Automator,选择“应用程序” 在动作列表中搜索“运行 Shell 脚本”,并粘贴以下两行: finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'` open -n -a "Visual Studio Code" --args "$finderPath" 如果你愿意,你也可以使用应用程序的 Bundle ID: finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'` open -n -b "com....

如何在 macOS Finder 中隱藏文件或文件夾

我對 macOS 在我的用戶文件夾中自動生成一個沒有任何理由的 Public 文件夾感到有些困擾。 我無法刪除它,因為這是一個系統文件夾。 所以我找到了一個方法來隱藏它。 打開終端並運行 chflags hidden <path> 命令,像這樣: chflags hidden Public 完成了! 如果需要將其恢復為可見,使用以下命令: chflags nohidden <path>